Python Forum

Full Version: can somone help with this crappy e-mail module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Following this example code but appears to be a poorly documented as always with the case with python modules and its documentation.

https://docs.python.org/2/library/email-examples.html

There is nothing in the message body:

s.sendmail(me, [you], msg.as_string())

Any tricks?

By saying " There is nothing in the message body:", I meant after receiving e-mail nothing is in the message body.
Presuming you are referring to the first example, the 'msg' referred to here:

s.sendmail(me, [you], msg.as_string())
is created here:

# Open a plain text file for reading.  For this example, assume that
# the text file contains only ASCII characters.
fp = open(textfile, 'rb')
# Create a text/plain message
msg = MIMEText(fp.read())
fp.close()
Did you create such a text file? Make sure you change 'textfile' to the actual file name.