-
Notifications
You must be signed in to change notification settings - Fork 6
/
testEmail.js
executable file
·29 lines (25 loc) · 976 Bytes
/
testEmail.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const nodemailer = require('nodemailer');
async function sendEmail() {
try {
// Create a transporter using SMTP with your Gmail and App Password
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]', // Your Gmail address
pass: 'kwxdxxcqeytkfufv' // Your generated App Password
}
});
const message = {
from: '[email protected]',
to: '[email protected]', // Email-to-SMS gateway for AT&T
subject: 'Test Email via Nodemailer and App Password',
text: 'This is a test email sent using Gmail and App Password without OAuth2.'
};
// Send email
const info = await transporter.sendMail(message);
console.log('Text sent successfully!', info);
} catch (error) {
console.error('Error sending text:', error);
}
}
sendEmail();