Proxy for SMTP (#5371)

This commit is contained in:
MeiMei 2019-09-02 04:42:52 +09:00 committed by syuilo
parent 96b2267cb8
commit 593c2b9517
3 changed files with 11 additions and 0 deletions

View File

@ -130,3 +130,11 @@ autoAdmin: true
#syslog: #syslog:
# host: localhost # host: localhost
# port: 514 # port: 514
# Proxy for HTTP/HTTPS
#proxy: http://127.0.0.1:3128
# Proxy for SMTP/SMTPS
#proxySmtp: http://127.0.0.1:3128 # use HTTP/1.1 CONNECT
#proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4
#proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5

View File

@ -34,6 +34,7 @@ export type Source = {
autoAdmin?: boolean; autoAdmin?: boolean;
proxy?: string; proxy?: string;
proxySmtp?: string;
accesslog?: string; accesslog?: string;

View File

@ -1,6 +1,7 @@
import * as nodemailer from 'nodemailer'; import * as nodemailer from 'nodemailer';
import { fetchMeta } from '../misc/fetch-meta'; import { fetchMeta } from '../misc/fetch-meta';
import Logger from './logger'; import Logger from './logger';
import config from '../config';
export const logger = new Logger('email'); export const logger = new Logger('email');
@ -14,6 +15,7 @@ export async function sendEmail(to: string, subject: string, text: string) {
port: meta.smtpPort, port: meta.smtpPort,
secure: meta.smtpSecure, secure: meta.smtpSecure,
ignoreTLS: !enableAuth, ignoreTLS: !enableAuth,
proxy: config.proxySmtp,
auth: enableAuth ? { auth: enableAuth ? {
user: meta.smtpUser, user: meta.smtpUser,
pass: meta.smtpPass pass: meta.smtpPass