add js script using nodemailer for testing smtp delivery

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-08-06 11:34:05 -04:00
parent 169a6d1fa8
commit d20dd7d11e
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 42 additions and 0 deletions

42
smtp/ses_email.js Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env node
const nodemailer = require('nodemailer')
const SMTP_CONF = {
host: 'email-smtp.us-east-1.amazonaws.com',
port: 465,
secure: process.env.SMTP_TLS,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
}
const EMAIL = {
from: 'Dapps Approvals <dapps-approvals@status.im>',
to: 'jakub@status.im',
subject: 'Test Email',
text: 'Test email from status-im/infra-utils/blob/master/smtp/ses_email.js',
}
async function main() {
let rval
let smtp = nodemailer.createTransport(SMTP_CONF)
console.log('Sending:')
console.dir(EMAIL)
try {
await smtp.verify()
rval = await smtp.sendMail(EMAIL)
} catch (e) {
console.error(`Email delivery failed: ${e}`)
return
}
console.log('Response:')
console.dir(rval)
console.log(`Email delivered successfully!`)
}
main()