Start New Discussion within our Software Development Community

I have this email program but it doestn seem to work, the emaik never arive at the reciever, not even in his spam folder

from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from smtplib import SMTP

msg = MIMEMultipart()
msg['Subject'] = 'Email From Python jajaja'
msg['From'] = ''
msg['Reply-to'] = 'otroemail@dominio'
msg['To'] = ''

# That is what u see if dont have an email reader:
msg.preamble = 'Multipart massage.\n'

# This is the textual part:
part = MIMEText("Hello im sending an email from a python program")

# This is the binary part(The Attachment):
part = MIMEApplication(open("TEST.txt","rb").read())
part.add_header('Content-Disposition', 'attachment', filename="TEST.txt")

# Create an instance in SMTP server
smtp = SMTP("")
# Start the server:
smtp.login("", "mipassword")

# Send the email
smtp.sendmail(msg['From'], msg['To'], msg.as_string())

So how do I send emails then? Can you send emails without having to create a SMTP server, if so how?

This question has already been answered. Start a new discussion instead.