Click here to Skip to main content
6,822,613 members and growing! (16,339 online)
Email Password   helpLost your password?
General Programming » Internet / Network » Email     Intermediate License: The GNU General Public License (GPL)

Custom GMail Vacation Auto-Responder

By _Khallaf

Use IMAP to auto-reply to unread GMail messages while on vacation
VB (VB8.0, VB9.0), .NET (.NET2.0, .NET3.0, .NET3.5), Visual-Studio (VS2005, VS2008), Dev, SysAdmin
Revision:10 (See All)
Posted:22 May 2009
Updated:27 May 2009
Views:8,291
Bookmarked:22 times
Prize winner in Competition "Best VB.NET article of May 2009"
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
14 votes for this article.
Popularity: 5.06 Rating: 4.42 out of 5
1 vote, 7.1%
1

2
1 vote, 7.1%
3
2 votes, 14.3%
4
10 votes, 71.4%
5

Introduction

I'm a Systems Engineer who works in an Anonymous Company. My indirect supervisor (my boss's boss) wanted to have a custom GMail Vacation Auto-Responder that would:

  1. Have a list of involved GMail accounts.
  2. Connect to GMail and identify unread messages.
  3. Auto-Reply to the senders of those unread messages with a custom auto-reply template.

Well, this could have been done easily using the GMail Atom Feed (https://mail.google.com/mail/feed/atom/), but since the atom only provides access to the very latest 20 unread messages, it could not be used for that purpose.

So, I had only one of two choices, either use POP3 or IMAP. Of course, IMAP was the right candidate for many considerations, the most prudent of which is its resourceful command-set. I had to design the tool (a Windows Service in this case) with minimal data transfer/session time in mind, because Google becomes touchy when you over-use IMAP with its servers.

I was new to the whole Socket/IMAP thing, so I had to get my feet wet. I designed the tool, planned it well, and thought the best work-flow would go like this:

  1. Loop into an account collection.
  2. For each account:
    • open connection
    • connect to GMail
    • get list of unread messages *since* a pre-set start-date
    • get headers of those messages
    • parse those headers and extract (Message-ID, From)
    • record unique From headers, based on Message-ID header, for non-duplicity
    • set unread messages that have been processed as "read"
    • close connection with GMail
  3. Start auto-responding with the auto-reply template for all collected senders.

Well, my boss's boss had some comments - that he never really declared which makes them IMPLICIT :D :D :D - on the way the tool works, but he decided to spell the word only when I announced that my proto-type code is done. He is not supposed to be technically involved - I mean into code - although he really involves himself into bits and bytes, and he has not even seen the code, not to mention that he might not fully understand it, but yet somehow he declared that what I did was a waste of time.

Hence, being a time-waster I decided that I might make it a habit of my own and waste your own time as well :D :D :D by posting the code of that little tool. So, please enjoy wasting your time with my code :D :D :D.

Project Code and Usage Notes

Please download the final project code and usage notes from http://admincraft.net.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPL)

About the Author

_Khallaf


Member

Location: Egypt Egypt

Other popular Internet / Network articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh)FirstPrevNext
GeneralMy vote of 1 PinmemberMember 294974315:44 26 Jan '10  
GeneralRe: My vote of 1 Pinmember_Khallaf9:09 27 Jan '10  
GeneralCongratulations PinmemberAbhishek Sur23:06 22 Jun '09  
GeneralRe: Congratulations Pinmember_Khallaf0:20 23 Jun '09  
GeneralIf you like it, please vote for this article as Best VB.Net article. Pinmember_Khallaf11:05 12 Jun '09  
GeneralFixes and updates Pinmember_Khallaf9:19 10 Jun '09  
GeneralFinal Update Pinmember_Khallaf0:35 28 May '09  
GeneralBetter Code Highlighting + Updates to the Article (if any) Pinmember_Khallaf0:39 23 May '09  
GeneralRe: Better Code Highlighting + Updates to the Article (if any) Pinmember_Khallaf3:57 23 May '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.

PermaLink | Privacy | Terms of Use
Last Updated: 27 May 2009
Editor: Deeksha Shenoy
Copyright 2009 by _Khallaf
Everything else Copyright © CodeProject, 1999-2010
Web18 | Advertise on the Code Project