This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-atr-experiments.git
The following commit(s) were added to refs/heads/main by this push:
new 16dc196 Use the ASF mail relay
16dc196 is described below
commit 16dc19642ed5e9b23648677551123152b8b10846
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Mar 6 14:50:30 2025 +0200
Use the ASF mail relay
---
atr/mail.py | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/atr/mail.py b/atr/mail.py
index 3e6158e..18a1914 100644
--- a/atr/mail.py
+++ b/atr/mail.py
@@ -188,25 +188,24 @@ class LoggingSMTP(smtplib.SMTP):
def send_one(mx_host: str, from_addr: str, to_addr: str, msg_reader: StringIO)
-> None:
- """Send an email to a single recipient via a specific MX server."""
+ """Send an email to a single recipient via the ASF mail relay."""
default_timeout_seconds = 30
try:
- # Connect to the SMTP server
- logging.info(f"Connecting to {mx_host}:25")
- smtp = LoggingSMTP(mx_host, 25, timeout=default_timeout_seconds)
+ # Connect to the ASF mail relay
+ mail_relay = "mail-relay.apache.org"
+ logging.info(f"Connecting to {mail_relay}:587")
+ smtp = LoggingSMTP(mail_relay, 587, timeout=default_timeout_seconds)
smtp.set_debuglevel(2)
# Identify ourselves to the server
smtp.ehlo(global_domain)
- # If STARTTLS is available, use it
- if smtp.has_extn("STARTTLS"):
- context = ssl.create_default_context()
- context.minimum_version = ssl.TLSVersion.TLSv1_2
- smtp.starttls(context=context)
- # Re-identify after TLS
- smtp.ehlo(global_domain)
+ # Use STARTTLS for port 587
+ context = ssl.create_default_context()
+ context.minimum_version = ssl.TLSVersion.TLSv1_2
+ smtp.starttls(context=context)
+ smtp.ehlo(global_domain)
# Send the message
smtp.mail(from_addr)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]