Skip to content

Instantly share code, notes, and snippets.

@carloslenondavis
Created June 11, 2021 06:20
Show Gist options
  • Save carloslenondavis/5a76c51217f1a513f2d1d1220ba6e91d to your computer and use it in GitHub Desktop.
Save carloslenondavis/5a76c51217f1a513f2d1d1220ba6e91d to your computer and use it in GitHub Desktop.
Implementation for SMPT.JS to send email with js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<button onclick="SendMailTo()">Send Email</button>
<script src="https://smtpjs.com/v3/smtp.js"></script>
<script src="script.js"></script>
</body>
</html>
function SendMailTo() {
Email.send({
Host: "smtp.elasticemail.com",
Username: "[email protected]",
Password: "0E6ADCFB0D49022EB1BAB157BD25EB0FA4A5",
To: '[email protected]',
From: "[email protected]",
Subject: "This is the subject",
Body: "And this is the body",
Attachments: [
{
name: "smtpjs.png",
path: "https://networkprogramming.files.wordpress.com/2017/11/smtpjs.png"
}],
}).then(message => console.log(message));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment