BREAKING CHANGE(smartsmtp): now supports sending mails with sendmail

This commit is contained in:
2021-06-15 17:31:01 +02:00
parent c018435aa1
commit 2b4024b535
5 changed files with 18380 additions and 3694 deletions

View File

@ -9,7 +9,7 @@ const testQenv = new Qenv('./', './.nogit');
let testSmartsmtp: smartsmtp.Smartsmtp;
tap.test('should create a valid instance of Smartsmtp', async () => {
testSmartsmtp = new smartsmtp.Smartsmtp({
testSmartsmtp = await smartsmtp.Smartsmtp.createSmartsmtpWithRelay({
smtpServer: testQenv.getEnvVarOnDemand('SMTP_SERVER'),
smtpUser: testQenv.getEnvVarOnDemand('SMTP_USER'),
smtpPassword: testQenv.getEnvVarOnDemand('SMTP_PASSWORD'),
@ -17,7 +17,7 @@ tap.test('should create a valid instance of Smartsmtp', async () => {
expect(testSmartsmtp).to.be.instanceOf(smartsmtp.Smartsmtp);
});
tap.test('should send a message', async () => {
tap.test('should send a message with empty body', async () => {
const result = await testSmartsmtp.sendSmartMail(
new smartmail.Smartmail({
body: '',
@ -29,4 +29,17 @@ tap.test('should send a message', async () => {
console.log(result);
});
tap.test('should create a direct smartsmtp transport', async () => {
const smartsmtpInstance = await smartsmtp.Smartsmtp.createSmartsmtpSendmail();
const result = await smartsmtpInstance.sendSmartMail(
new smartmail.Smartmail({
body: 'hi there',
from: 'phil@lossless.com',
subject: 'this is a sendmail test message',
}),
'phil@kunz.io'
);
console.log(result);
})
tap.start();