Add ANDROID_SECURITY_PLAN.md to project
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
function createMailConnections({ ImapFlow, createTransport, oauthTokenManager }) {
|
||||
function createMailConnections({ ImapFlow, createTransport, getImapFlow, getNodemailer, oauthTokenManager }) {
|
||||
let ImapFlowModule = ImapFlow;
|
||||
let nodemailerModule = createTransport ? { createTransport } : null;
|
||||
|
||||
async function imapClient(account, options = {}) {
|
||||
if (!ImapFlowModule) {
|
||||
const module = await getImapFlow();
|
||||
ImapFlowModule = module.ImapFlow || module.default || module;
|
||||
}
|
||||
const isOAuth = account.authMethod === 'oauth2';
|
||||
const auth = isOAuth
|
||||
? { user: account.email, accessToken: await oauthTokenManager.getAccessToken(account) }
|
||||
: { user: account.email, pass: account.password };
|
||||
return new ImapFlow({
|
||||
return new ImapFlowModule({
|
||||
host: account.imapHost,
|
||||
port: account.imapPort,
|
||||
secure: Boolean(account.imapSecure),
|
||||
@@ -20,6 +27,9 @@ function createMailConnections({ ImapFlow, createTransport, oauthTokenManager })
|
||||
}
|
||||
|
||||
async function smtpTransport(account) {
|
||||
if (!nodemailerModule) {
|
||||
nodemailerModule = await getNodemailer();
|
||||
}
|
||||
const isOAuth = account.authMethod === 'oauth2';
|
||||
const auth = isOAuth
|
||||
? {
|
||||
@@ -30,7 +40,7 @@ function createMailConnections({ ImapFlow, createTransport, oauthTokenManager })
|
||||
}
|
||||
: { user: account.email, pass: account.password };
|
||||
const secure = Boolean(account.smtpSecure);
|
||||
return createTransport({
|
||||
return nodemailerModule.createTransport({
|
||||
host: account.smtpHost,
|
||||
port: account.smtpPort,
|
||||
secure,
|
||||
|
||||
Reference in New Issue
Block a user