Sending an Email via Python -
i'm attempting send email python. can tell, following code needs valid recipient , host host. i'm unsure on how host. simplest way?
import smtplib import string subject = "test email python" = "python@mydomain.com" = "python@mydomain.com" text = "blah blah blah" body = string.join(( "from: %s" % from, "to: %s" % to, "subject: %s" % subject , "", text ), "\r\n") server = smtplib.smtp(host) server.sendmail(from, [to], body) server.quit()
the host smtp relay provided isp (typically related domain name of address). if use desktop mail client, you'll able see smtp server listed in mail settings. if you're hosting using shared hosting, hosting provider should able provide smtp server use.
Comments
Post a Comment