Skip to Content
0

Is it possible to send page content via email using UI5?

Jan 18, 2017 at 09:18 AM

49

avatar image

My application is designed to create a table which is later edited by the user. After this I need my application to send the page content via email.

I used URLHelper's trigger email() but through this I am able to trigger the email with to, cc, subject, text body but my ui5 application is not able to insert the table into the email.

Can someone please suggest something? or is it even possible? I won't mind using plain javascript either, Point is I need to do this without using the backend.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
VIPLOVE KHUSHALANI Jan 18, 2017 at 12:14 PM
1

Hi

Its better you should do this using server side scripting language like JAVA or PHP , but still you want it on UI5/Javascript (client side) than below are the different ways with different use cases:

1. For plain text body use this on button click : window.open('mailto:test@example.com?subject=subject&body=Testing Email');

2. For HTML content (not recommended but only way) : Using .eml file (MIME object) : we will create a text file(.txt) and downloaded it as .eml file file. Check out this code on fiddler which does the same. When you click on create file, it then gives you a download link to download your .eml file. The only hurdle is making the browser open the .eml file after it has been downloaded. For that you could set the browser to always open files of that type. For instance in Chrome, you can click on the arrow beside the download and select always open files of this type.(For instant opening of client you need to tell the user to make that default settings on his/her browser)

Note :

1. 2nd option is only for those email clients which supports HTML.

2. 2nd option will create a file in the users download folder. So as many number of times user clicks to send mail that many number of time file is created in local so user needs to clear them when there are lot of files.

3. 1st option only supports plain text so you can't send data in table format

4. 2nd options is not recommended , recommend to do this on server side.

thanks

Viplove

Share
10 |10000 characters needed characters left characters exceeded