2
Answers

How to Send mail automatically thru external javascript ?

Sanket Jain

Sanket Jain

7y
138
1
I write external javascript file in my project to get data(.i.e. Temp.) from database.
I want to send message from that javascript file if I got  Temp>80.
So how to send mail  automatically thru external javascript file?
I call this javascript on MasterPage. 
Answers (2)
1
Nilesh Patil

Nilesh Patil

NA 3.4k 6.9k 7y
Hi Sanket,
 
Using javascript you can't send emails directly.
 
You need to invoke server side code for sending mail. Also you might need to configure SMTP server, mail server to successfully send mail.
 
just including sendmail.jar isn't the solution. you need to call methods from some of the class to send mail.
 
here is a brief description and code to send mail.
 
http://www.codeproject.com/KB/java/Java_Mail.aspx?msg=1520181
0
Ankit Sharma

Ankit Sharma

NA 8.8k 140.9k 7y
Hi Sanket,
 
Sending mail from only javasript is not possible, but you can open user's mail client and ask the user to send mail.
 
Another solution is make a Ajax call to your server and send mail via your server
Refer this
 
https://stackoverflow.com/questions/7381150/how-to-send-an-email-from-javascript
 
also check this API, if it can be of your help
 
https://www.emailjs.com/