3

I need to generate an e-mail template from the web application and then open user e-mail client populated with that template. The most common way to do that is to use mailto: protocol

const mailtoLink = 
  'mailto:' + email +
  '?subject=' + subject +
  '&body=' + encodeURIComponent(emailBody);

But I have to use a plenty of cyrillic symbols in the body, thus my encoded link exceeds 2500 characters, and client app just won't open when clicking such a link (in my case maximum length that works is 2044 symbols)

The other solution I've come to is generating an .eml file and making user to download/open it, using approach of this thread, but it has encoding issues and lowers the overall user experience.

Are there any other ways to achieve what I want?

fires3as0n
  • 421
  • 5
  • 13
  • I don't think so. But you might want to consider alternatives like a) sending the email through your own server, not using the user's email client b) writing an email client add-on instead of a web application – Bergi Jul 25 '19 at 12:41
  • Wat are the encoding issues with the EML file? – Dmitry Streblechenko Jul 26 '19 at 15:10

1 Answers1

0

Generating .eml files is a universal solution. Also, you may consider automating Outlook from a web browser. But in this scenario, you can do that from Internet Explorer (i.e. on Windows only). See Compose and Send E-mail from JavaScript by using Outlook Automation 2007 for more information.

Please remember that EML and MSG file formats are well-described. For example, see Outlook Item (.msg) File Format.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45