Om Prakash <torque.in...@gmail.com> Wrote in message:
> Hi,
> 
> I am writing this program from 
> https://docs.python.org/2/library/email-examples.html
> 
> but getting the error as
> 
> singhom@debian:~/pythons$ python send_email.py
> Traceback (most recent call last):
>    File "send_email.py", line 18, in <module>
>      msg['Subject']  = 'The contents of $s' % message
> NameError: name 'message' is not defined
> 
> 
> i know the error would be something simple and i am overlooking it, any 
> help would be highly appreciated, I am sorry, but I am very new to 
> python programming.
> 
> code starts here.
> #/usr/bin/python2.7 -tt
> 
> ## sending a simple text message using python.
> import smtplib
> 
> from email.mime.text import MIMEText
> 
> # Open file for reading.
> fp = open("message", 'rb')
> # Create a plain text message.
> msg = MIMEText(fp.read())
> 
> fp.close

This line doesn't do anything.  If you want to close the file, 
 you need some parens,  Or you can use the 'with' form instead of
 open.

> 
> me = "torque.in...@gmail.com"
> you = "oomprak...@gmail.com"
> 
> msg['Subject']  = 'The contents of $s' % message

Just what did you plan to use here? You never defined a variable
 called message. If you intended to use msg, I presume you realize
 it could be quite large,



-- 
DaveA

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to