tags:

views:

147

answers:

3

buildin an smtp client in python . which can send mail , and also show that mail has been received through any mail service for example gmail !!

+1  A: 

If you want the Python standard library to do the work for you (recommended!), use smtplib. To see whether sending the mail worked, just open your inbox ;)

If you want to implement the protocol yourself (is this homework?), then read up on the SMTP protocol and use e.g. the socket module.

Stephan202
A: 

Depends what you mean by "received". It's possible to verify "delivery" of a message to a server but there is no 100% reliable guarantee it actually ended up in a mailbox. smtplib will throw an exception on certain conditions (like the remote end reporting user not found) but just as often the remote end will accept the mail and then either filter it or send a bounce notice at a later time.

SpliFF
+1  A: 

Create mail messages (possibly with multipart attachments) with email.

The email package is a library for managing email messages, including MIME and other RFC 2822-based message documents.

Send mail using smtplib

The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.

If you are interested in browsing a remote mailbox (for example, to see if the message you sent have arrived), you need a mail service accessible via a known protocol. An popular example is the imaplib module, implementing the IMAP4 protocol. IMAP is supported by gmail.

This (imaplib) module defines three classes, IMAP4, IMAP4_SSL and IMAP4_stream, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in RFC 2060. It is backward compatible with IMAP4 (RFC 1730) servers, but note that the STATUS command is not supported in IMAP4.

gimel