email varification using smtplib or any method

jitendra gupta jitu.icfai at gmail.com
Thu Feb 19 23:58:24 EST 2009


hello
here is my code for sending the mail, using this code email is going
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''    CODE
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
import smtplib
from time import strftime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.Utils import COMMASPACE, formatdate


# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = " is sending the mail"
msg['From'] = 'jitu.icfai at myprivatedomain.com <jitu.icfai at domain.com>'
msg['Date'] = formatdate(localtime=True)
msg['To'] = 'jitu.icfai at gmail.com'

# Create the body of the message (a plain-text and an HTML version).
#text = "jitendra kya huy a!\nHow are you?\nHere is the link you
wanted:\nhttp://www.python.org"
html = """\
<html>
  <head></head>
  <body>
    <p>Hi!<br>
       How are you?<br>
       This mail is send by wjitenrda
       Here is the <a href="http://www.python.org">link</a> you wanted.
    </p>
  </body>
</html>
"""

part2 = MIMEText(html, 'html')


msg.attach(part2)

# Send the message via local SMTP server.
s = smtplib.SMTP('smtp.myprivatedomain.com <http://name.com>')
s.login("user","password")
s.sendmail(msg['From'], msg['To'], msg.as_string())
s.close()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''    CODE  END
 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
using this code i am able to send the email , but problem is
when i am changing
msg['To'] = "wronguser at wrongdomain.comddsdjsdsdsjdh"
some wrong email then i am getting back failure notice in my inbox, which i
dont want..
is there any way so that i can identify wrong email during the run time
(when i am sending  the email)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090220/fc73d6c3/attachment.html>


More information about the Python-list mailing list