0

I am trying to send a message with python using the smtplib library. Here is the code I am using:

server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login(EMAIL, PASS)
server.sendmail(EMAIL, phone_number +"@"+ carrier_address, msg)
server.quit()

I am using the port 465 to use a secure connection when connecting, but this still gets the message blocked when sending to a tmobile phone number. It seems that any other carrier works.

Has anyone else run into this issue? My website depends on these texts, and they have to be on time, so this is a very bad bug.

Is there a workaround to this or any other library out there to make this work?

rishubk
  • 441
  • 2
  • 8
  • 19

1 Answers1

0

Assuming you are getting the 550 block message from T-Mobile, I found this discussion that goes over the problem. Ths gist is downwards, but here's the main quote:

Sender Policy Framework 550 status message is part of spam validation screening. "550" is part of a long list of SMTP status codes to help diagnose connection issues. Mail relays connecting to @tmomail.net DNS and MX (mail) records must match or be authorized on behalf of another domain. The mismatch can occur in the registered domain or the shared ISP network connection.

I don't know how to update DNS or MX records as I am just a humble pythoner trying to text some folks. If you worked through your error already, what worked for you? Thanks.

agugliemo
  • 3
  • 3