Apr-14-2024, 03:43 AM
My cell phone is on the U.S. carrier Verizon - and I can send a text to myself by emailing [email protected], where the letters are the placeholder is my phone number.
I am trying to create a python script that upon execution will send a text to my number. My script is below, with sample instead of my real info:
My script also works to send email, I can get it without issue.
However, when I sent to @vtext.com from the python script, it never makes it. Now, if I login to webmail with the same email as in the python script and send to @vtext.com, the text goes through. But not python.
I suspect it's probably some anti-spam stuff in the email headers. The webmail interface is likely sending that to @vtext.com, but the python script is not. Any ideas to what the solution may be?
I am trying to create a python script that upon execution will send a text to my number. My script is below, with sample instead of my real info:
import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart message = MIMEMultipart() message["From"] = "[email protected]" message["To"] = "[email protected]" message["Subject"] = "Python Script Completion" message.attach(MIMEText("test test", "plain")) try: # Create a secure SSL context server = smtplib.SMTP("test.com", 587) server.starttls() # Secure the connection server.login(message["From"], "PASSWORD") # Send the email server.sendmail(message["From"], message["To"], message.as_string()) print("Completion email sent to", message["To"]) except Exception as e: # Print any error messages to stdout print(e) finally: server.quit()My webserver setup is a standard cpanel webserver running on linux. I have email services running there like normal.
My script also works to send email, I can get it without issue.
However, when I sent to @vtext.com from the python script, it never makes it. Now, if I login to webmail with the same email as in the python script and send to @vtext.com, the text goes through. But not python.
I suspect it's probably some anti-spam stuff in the email headers. The webmail interface is likely sending that to @vtext.com, but the python script is not. Any ideas to what the solution may be?