feat: support different SMTP ports for email sending
- Add conditional logic to handle SMTP_PORT 465 for secure connections. - Use standard SMTP for other ports to allow flexibility in email server configurations. This change enhances the email sending functionality by allowing users to specify different SMTP ports, improving compatibility with various email service providers. The previous implementation only supported port 465, which limited its usability.
This commit is contained in:
parent
5821fefcae
commit
f7770955a9
24
mail.sh
24
mail.sh
@ -20,13 +20,23 @@ Date: $(date -R)
|
|||||||
|
|
||||||
$BODY"
|
$BODY"
|
||||||
|
|
||||||
curl -s --url "smtps://$SMTP_SERVER:$SMTP_PORT" \
|
if [ "$SMTP_PORT" == 465 ]; then
|
||||||
--mail-from "$MAIL_FROM" \
|
curl -s --url "smtps://$SMTP_SERVER:$SMTP_PORT" \
|
||||||
--mail-rcpt "$MAIL_TO" \
|
--mail-from "$MAIL_FROM" \
|
||||||
--upload-file - \
|
--mail-rcpt "$MAIL_TO" \
|
||||||
--ssl-reqd \
|
--upload-file - \
|
||||||
--user "$SMTP_USER:$SMTP_PASS" \
|
--ssl-reqd \
|
||||||
<<< "$email_content"
|
--user "$SMTP_USER:$SMTP_PASS" \
|
||||||
|
<<< "$email_content"
|
||||||
|
else
|
||||||
|
curl -s --url "smtp://$SMTP_SERVER:$SMTP_PORT" \
|
||||||
|
--mail-from "$MAIL_FROM" \
|
||||||
|
--mail-rcpt "$MAIL_TO" \
|
||||||
|
--upload-file - \
|
||||||
|
--ssl-reqd \
|
||||||
|
--user "$SMTP_USER:$SMTP_PASS" \
|
||||||
|
<<< "$email_content"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 主函数
|
# 主函数
|
||||||
|
Loading…
Reference in New Issue
Block a user