update
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { SmtpClient } from '../../ts/mail/delivery/classes.smtp.client.js';
|
||||
import type { ISmtpClientOptions } from '../../ts/mail/delivery/smtpclient/interfaces.js';
|
||||
import { Email } from '../../ts/mail/core/classes.email.js';
|
||||
|
||||
/**
|
||||
* Create a test SMTP client
|
||||
@ -10,18 +11,11 @@ export function createTestSmtpClient(options: Partial<ISmtpClientOptions> = {}):
|
||||
port: options.port || 2525,
|
||||
secure: options.secure || false,
|
||||
auth: options.auth,
|
||||
ignoreTLS: options.ignoreTLS || true,
|
||||
requireTLS: options.requireTLS || false,
|
||||
connectionTimeout: options.connectionTimeout || 5000,
|
||||
socketTimeout: options.socketTimeout || 5000,
|
||||
greetingTimeout: options.greetingTimeout || 5000,
|
||||
maxConnections: options.maxConnections || 5,
|
||||
maxMessages: options.maxMessages || 100,
|
||||
rateDelta: options.rateDelta || 1000,
|
||||
rateLimit: options.rateLimit || 5,
|
||||
logger: options.logger || false,
|
||||
debug: options.debug || false,
|
||||
authMethod: options.authMethod || 'PLAIN',
|
||||
tls: options.tls || {
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
@ -51,7 +45,14 @@ export async function sendTestEmail(
|
||||
html: options.html
|
||||
};
|
||||
|
||||
return client.sendMail(mailOptions);
|
||||
const email = new Email({
|
||||
from: mailOptions.from,
|
||||
to: mailOptions.to,
|
||||
subject: mailOptions.subject,
|
||||
text: mailOptions.text,
|
||||
html: mailOptions.html
|
||||
});
|
||||
return client.sendMail(email);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,11 +96,10 @@ export function createAuthenticatedClient(
|
||||
port,
|
||||
auth: {
|
||||
user: username,
|
||||
pass: password
|
||||
pass: password,
|
||||
method: authMethod
|
||||
},
|
||||
authMethod,
|
||||
secure: false,
|
||||
ignoreTLS: true
|
||||
secure: false
|
||||
});
|
||||
}
|
||||
|
||||
@ -111,7 +111,6 @@ export function createTlsClient(
|
||||
port: number,
|
||||
options: {
|
||||
secure?: boolean;
|
||||
requireTLS?: boolean;
|
||||
rejectUnauthorized?: boolean;
|
||||
} = {}
|
||||
): SmtpClient {
|
||||
@ -119,8 +118,6 @@ export function createTlsClient(
|
||||
host,
|
||||
port,
|
||||
secure: options.secure || false,
|
||||
requireTLS: options.requireTLS || false,
|
||||
ignoreTLS: false,
|
||||
tls: {
|
||||
rejectUnauthorized: options.rejectUnauthorized || false
|
||||
}
|
||||
|
Reference in New Issue
Block a user