from import MIMEMultipartįrom import MIMEText # Added However, see below for a modernized version. I have not attempted to send the resulting message. The following is an edit of your script with the missing pieces added. A multipart message by itself has no contents at all, you have to add a text part if you want a text part. You should probably begin by understanding what the proper MIME structure looks like. You are going through royal pains to construct a valid MIME message in msg, then ditching it and sending a simple string email_message instead. #ndmail(from_addr, to_addr, msg.as_string())Īs you can tell from the code above I've tried different ways (referencing the #) #email_message = '%s\n%s\n%s' % (subject_header, body, img)Įmail_message = '%s\n%s' % (subject_header, body)ĮmailRezi = smtplib.SMTP(mail_server, mail_server_port)ĮmailRezi.login(mail_username, mail_password)Įndmail(from_addr, to_addr, email_message) Note that I am using Python 3.2.2.Īny guidance would be appreciated. I have researched online and the solutions are not working for me. I've come across a problem where I can attach the email but my quotes no longer work. I'm now trying to embed an image in the email as well. I currently have a program that will randomly select quotes from a list and email them.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |