4

I am trying to build a Python program for small business.

My customers will send their orders in plain texts via email to me. My first thought is to use Gmail as my email server so I could write a small IMAP Python program to check for incoming emails from my Gmail account. However, I am worried that Google has a limit for email checking frequency (i.e., "polling") and/or bandwidth.

If I am checking new email once every 10 seconds, I'm concerned that Google will lock my account in just a few minutes - I'm afraid to even try this.

I am not experienced enough to set up my own email server in a Linux box yet. What options do I have? Will upgrading to Google Business email solve this problem, or are there any other vendors that provide IMAP servers which offer more bandwidth and permit increased email checking frequencies?

3 Answers 3

3

If you poll the email account too often you will get this error:

ERR [AUTH] Web login required: https://support.google.com/mail/bin/answer.py?answer=78754

Which leads to

https://support.google.com/mail/answer/78754

Which says

Make sure your mail client isn't set to check for new mail too often. If your mail client checks for new messages more than once every 10 minutes, your client might repeatedly request your username and password.

2

There are reports of login limits and accounts becoming temporarily frozen, sometimes requiring a Captcha login. If that occurs, then you'll be delayed in receiving orders...

This seems like a very inefficient business solution - emails from different servers can get blocked, rejected, etc... Have you thought about using Python (or PHP) for a server-side application, like a simple form mailer? Using that, you can save the orders to a text file on the same server so you'll have a backup, as well as email them to you.

9
  • Thanks a lot for your answer. By simple form mailer, do you mean web application that uses html forms to get orders from users? Yes, but I planed to build the email ordering system first, then SMS, and only after that will I start building a website. Jun 18, 2013 at 7:18
  • No problem, thanks for elaborating on your plans. Yes, I had meant a "CGI" HTML form, which could be emailed as an HTML formatted email as well, but would bypass the recipient's email server since it would do a GET or POST back to your server. As for email providers with less restrictions, it's difficult to know this since most would restrict IP access so they aren't flooded with requests. If you run your own email server, you can control that better however. I was thinking about posting a question and answer on how to easily setup a mail server since Google App engine is now a paid service...
    – dan
    Jun 18, 2013 at 12:38
  • ...and many people are using that and Gmail for their business email. Let me know if that might be helpful to you. Best of luck!
    – dan
    Jun 18, 2013 at 12:39
  • I didn't know GAE also supports email. Thanks a lot. I looked at their API. Emails received are treated as HTTP requests which is even better than I wanted. Jun 18, 2013 at 13:59
  • 2
    Yes. There is a cool third party SMS service called Twilio in GAE. I didn't know so many great things already exist in GAE's ecosystem. Thanks for pointing me to so many possibilities. Jun 19, 2013 at 3:15
1

Have you considered using IMAP protocol's idle command?

It will allow you to get real time notifications about new messages using/keeping single IMAP session open. Quick searches suggest IMAP idle is not supported by standard python imap library but there are available python libraries supporting it.

OR

Keep single imap session open and check INBOX folder frequently.

3
  • @Filip Thanks a lot. I didn't know about that. This is another good option. I will check out that in Python and see how it plays with GMail. Jun 19, 2013 at 2:52
  • For those who might also be wondering, there is an imaplib2 library that supports the idle command. Jun 19, 2013 at 3:10
  • And so is IMAPClient. Jun 19, 2013 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.