add smtp helo host (#220)

This commit is contained in:
Taehyung Lim 2024-05-02 17:15:18 +09:00 committed by GitHub
parent 7d1897b171
commit 41c5ac3626
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View File

@ -182,6 +182,8 @@ To send emails you'll need to use an existing SMTP server. Email sending will b
* `SMTP_HOST_PORT` (default: *25*): The SMTP port on the SMTP server. * `SMTP_HOST_PORT` (default: *25*): The SMTP port on the SMTP server.
* `SMTP_HELO_HOST` (no default): The hostname to send with the HELO/EHLO command.
* `SMTP_USERNAME` (no default): The username to use when the SMTP server requires authentication. * `SMTP_USERNAME` (no default): The username to use when the SMTP server requires authentication.
* `SMTP_PASSWORD` (no default): The password to use when the SMTP server requires authentication. * `SMTP_PASSWORD` (no default): The password to use when the SMTP server requires authentication.

View File

@ -134,6 +134,7 @@
$SMTP['user'] = (getenv('SMTP_USERNAME') ? getenv('SMTP_USERNAME') : NULL); $SMTP['user'] = (getenv('SMTP_USERNAME') ? getenv('SMTP_USERNAME') : NULL);
$SMTP['pass'] = (getenv('SMTP_PASSWORD') ? getenv('SMTP_PASSWORD') : NULL); $SMTP['pass'] = (getenv('SMTP_PASSWORD') ? getenv('SMTP_PASSWORD') : NULL);
$SMTP['port'] = (getenv('SMTP_HOST_PORT') ? getenv('SMTP_HOST_PORT') : 25); $SMTP['port'] = (getenv('SMTP_HOST_PORT') ? getenv('SMTP_HOST_PORT') : 25);
$SMTP['helo'] = (getenv('SMTP_HELO_HOST') ? getenv('SMTP_HELO_HOST') : NULL);
$SMTP['ssl'] = ((strcasecmp(getenv('SMTP_USE_SSL'),'TRUE') == 0) ? TRUE : FALSE); $SMTP['ssl'] = ((strcasecmp(getenv('SMTP_USE_SSL'),'TRUE') == 0) ? TRUE : FALSE);
$SMTP['tls'] = ((strcasecmp(getenv('SMTP_USE_TLS'),'TRUE') == 0) ? TRUE : FALSE); $SMTP['tls'] = ((strcasecmp(getenv('SMTP_USE_TLS'),'TRUE') == 0) ? TRUE : FALSE);
if ($SMTP['tls'] == TRUE) { $SMTP['ssl'] = FALSE; } if ($SMTP['tls'] == TRUE) { $SMTP['ssl'] = FALSE; }

View File

@ -55,6 +55,10 @@ function send_email($recipient_email,$recipient_name,$subject,$body) {
$mail->Host = $SMTP['host']; $mail->Host = $SMTP['host'];
$mail->Port = $SMTP['port']; $mail->Port = $SMTP['port'];
if (isset($SMTP['helo'])) {
$mail->Helo = $SMTP['helo'];
}
if (isset($SMTP['user'])) { if (isset($SMTP['user'])) {
$mail->SMTPAuth = true; $mail->SMTPAuth = true;
$mail->Username = $SMTP['user']; $mail->Username = $SMTP['user'];