Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

send mail with javascript

// use formspree or EmailJS or SmtpJS 

// for SmtpJS 
//  configure your Gmail : Revoke 2-step verification and Enabling less secure apps to access Gmail
// setup SMTP Server 
<script src="https://smtpjs.com/v3/smtp.js"></script>
 sendMail.addEventListener('click', (e) => {
 	e.preventDefault();
 	Email.send({
 		SecureToken: "token",
 		To: 'destination mail',
 		From: "sender mail",
 		Subject: "This is the subject",
 		Body: "body content"
 	}).then(
 		message => alert(message)
 	);
 })
 
PREVIOUS NEXT
Tagged: #send #mail #javascript
ADD COMMENT
Topic
Name
2+1 =