Home ReactJs - Send Email with email body and attachment
Reply: 0

ReactJs - Send Email with email body and attachment

user1336
1#
user1336 Published in June 23, 2018, 8:00 am

just wondering how we can trigger MS Outlook new mail from client side, using ReactJs. The email should have some content (a table and some texts) in it, also with an attachment (PDF file) downloaded from server side. All the email content can be retrieved from state property 'this.state.data' (it's an array of objects).

Right now I have something below (an html way). When user clicks a button, It can open up new mail screen with subject and SentTo specified. How can I do the rest (content + attachment)?

<button type="button" className="btn btn-default"><a href="mailto:this.guy@gmail.com?subject=Test">Send Out Email</a></button>

For attachment, I need to (probably) write a get method to download from server first. Then how can we attach it to email?

I already know how to download it from server and display it on another tab (it works fine):

  handleDownload = (path) => {
    window.open(
        "/myController/GetFileFromServer?filePath=" + path,
        "_blank"
    );

Alternatively, I can also send email via server side, it feels easier for me. However, users likely need to enrich the email manually first before sending. Hence I thought client side would be more suitable for my case.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310024 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO