Jump to content

smtplib Quick Example

- - - - -

  • Please log in to reply
4 replies to this topic

#1
AIGuy

AIGuy

    Learning Programmer

  • Members
  • PipPipPip
  • 64 posts
looking on the web it is almost impossible to find an example of the smtplib being used to RETRIEVE mail. I've seen plenty of examples on how to send mail.

I'm trying to build a small program that will periodically check a gmail inbox for mail and upon finding an email with a certain subject (a secret code) it will send a response.

Can someone give me a brief example of this program?(or at least the retrieval aspect)

Edited by AIGuy, 25 May 2011 - 08:48 PM.


#2
AIGuy

AIGuy

    Learning Programmer

  • Members
  • PipPipPip
  • 64 posts
anyone? just a quick example of smtplib getting mail.

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You must understand that the SMTP protocol was not meant for mail access, you must look at IMAP or POP3 modules if those services are available on Gmail.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
fayyazlodhi

fayyazlodhi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 405 posts
Like Alexander said, SMTP is only for sending email. POP3 or IMAP are protocols for mail retrieval.

Gmail or for that matter any known service provider DOES not provide unencrypted email service for plain pop3 or imap. So your program has to use encryption (SSL mostly) to be able to fetch email successfully.

I remember finding aol.com to be an email service where i could configure in options to use unencrypted plain pop3 or imap.

#5
fayyazlodhi

fayyazlodhi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 405 posts
A student of mine a few years ago implemented both smtp and pop3 along with encryption in C# available at

Email Client Application by Implementing Our Own SMTP and POP3 protocols using C# - CodeProject




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users