mirror of
https://github.com/eleith/emailjs.git
synced 2026-11-14 14:34:00 +00:00
Apply the existing tabs, quotes, semicolon, and line-width conventions across source, tests, examples, documentation, and configuration. Include Oxfmt's parentheses around a conditional type without changing behavior.
26 lines
670 B
JavaScript
26 lines
670 B
JavaScript
import { Message } from '../dist/index.js'
|
|
import { getMailpitClient } from './mailpit-client.js'
|
|
|
|
async function sendTextEmail() {
|
|
const client = getMailpitClient()
|
|
|
|
const message = new Message({
|
|
from: 'sender@example.com',
|
|
to: 'recipient@example.com',
|
|
subject: 'Test Text Email to Mailpit',
|
|
text: 'This is a test text email sent from the emailjs library script to Mailpit.',
|
|
})
|
|
|
|
try {
|
|
console.log('Attempting to send text email...')
|
|
await client.sendAsync(message)
|
|
console.log('Text email sent successfully to Mailpit!')
|
|
} catch (error) {
|
|
console.error('Failed to send text email:', error)
|
|
} finally {
|
|
client.smtp.close()
|
|
}
|
|
}
|
|
|
|
sendTextEmail()
|