Is there a way to send an email in js without opening the mail app? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Is there a way to send an email in js without opening the mail app?

I've seen other email codes and they all open the email app, is there a way to send without the app?

10th Sep 2017, 5:06 PM
Joshua
Joshua - avatar
3 Answers
+ 8
You can't send an email directly with javascript. You can, however, open the user's mail client: window.open('mailto:test@example.com'); There are also some parameters to pre-fill the subject and the body: window.open('mailto:test@example.com?subject=subject&body=body'); Another solution would be to do an ajax call to your server, so that the server sends the email. Be careful not to allow anyone to send any email through your server.
10th Sep 2017, 5:27 PM
Ranjan Bagri
Ranjan Bagri - avatar
+ 1
can you change the to and from
10th Sep 2017, 5:49 PM
Joshua
Joshua - avatar
+ 1
that opens the app
10th Sep 2017, 11:10 PM
Joshua
Joshua - avatar