Using Email2Case with Google’s Gmail
I like Google, infact, I really love many of Google’s apps. There are many reasons to use Gmail - Google’s ‘new kind of webmail’ - and one of those is that it offers IMAP access. This is great for those of you who’ve been waiting to use the Salesforce’s Email2Case tool, and today I’m going to explain how to configure it to be used with Gmail.
Email2Case? What is it?
Email2Case ‘is a toolkit that pulls emails from your mail server and uses the Force.com API to create new cases or append to an existing case‘. In order to get more information about the tool and download it, please navigate here (note you will need a free developer account to access the page, you can subscribe for one here).
Gmail, Email2Case and Salesforce configuration
- First of all we need to subscribe for a free Gmail Account: navigate to the Signup Page, fill in the required information and in no time you’ll have obtained a new account.
- Email2Case will process the Gmail Inbox folder, but we also need to create the folders (Gmail calls them Labels) where the Processed or Error emails will go: so, within Gmail, let’s click on “Settings” > “Labels” and create 2 new labels: Error and Processed. That’s it, we’re done configuring Gmail.
- Now we need to work on the two Email2Case config files: email2case.txt and sfdcConfig.txt. If you haven’t already done so, download the Email2Case Toolkit and navigate to the directory where you have unzipped it (I keep it in C:\Email2Case).
- First let’s have a look at the email2case.txt. You’ll only need to change username@gmail.com and gmail_password with your newly created gmail address and password.
<configFile> <server1> <url>imap.gmail.com</url> <protocol>imaps</protocol> <userName>username@gmail.com</userName> <password>gmail_password</password> <interval>1</interval> <inbox>Inbox</inbox> <readbox>Processed</readbox> <errorbox>Error</errorbox> </server1> </configFile> - And now sfdcConfig.txt. Once again, the changes you’ll have to make are pretty straight-forward: just change salesforce_username_here and salesforce_password_here with your real Salesforce.com username and password.
<configFile> <sfdcLogin> <url>http://www.salesforce.com/services/Soap/u/7.0</url> <userName>salesforce_username_here</userName> <password>salesforce_password_here</password> <loginRefresh>30</loginRefresh> <timeout>5000</timeout> </sfdcLogin> <notify> <notifyEmail></notifyEmail> <from></from> <host>smtp.gmail.com</host> <port>465</port> <user></user> <password></password> <service>com.sforce.mail.SMTPNotification</service> </notify> <attachments> <largeAttachmentDirectory>C:\EmailAgent\LargeAttachments</largeAttachmentDirectory> <largeAttachmentURLPrefix>file:\\C:\EmailAgent\LargeAttachments</largeAttachmentURLPrefix> <largeAttachmentSize>1</largeAttachmentSize> </attachments> <services> <com.sforce.mail.EmailService>C:\\EmailAgent\\email2case.txt</com.sforce.mail.EmailService> </services> </configFile>
- First let’s have a look at the email2case.txt. You’ll only need to change username@gmail.com and gmail_password with your newly created gmail address and password.
- We’re almost ready, the last thing to do is to enable Email2Case in Salesforce.com and verify that everything works as expected. Login onto your Salesforce.com Organization and navigate to: Setup > Customize > Cases > Email-to-Case. Follow the steps to enable Email2Case and add the gmail address we created earlier as a “Routing Address”. That’s it, we should be set!
- Start the Email2Case Agent by double clicking on the email2case.bat file and make sure you get no errors, send an email to the gmail address and as soon as the Email2Case will pick that up, a new case will be created in your Salesforce.com Org.
If you need further help setting up the Email2Case Agent, please refer to this Salesforce.com Help page.
7 Comments, Comment or Ping
Hey Ale,
Any idea if Salesforce and Google can integrate in ways other than email to case? I have heard some buzz about this recently and am interested in learning more.
Best,
Adam
Salesforcetimes.com
@Adam: Hi, I also heard about few rumours; I’ve no further information, but let’s keep the finger crossed and hope this is happening soon.
Ale
I have not got this to work yet. I am getting some time out errors when I run the script. I do not think the google server is aloowing me to connect.
@ak: Make sure IMAP is enabled on Gmail; also, can you post the errors?
HI all.
Here are the errors I get when trying to connect.
2008-04-02 08:48:14,369 7162 [main] INFO com.sforce.mail.EmailService - ReadBox : Sent Mail
2008-04-02 08:48:14,370 7163 [main] INFO com.sforce.mail.EmailService - ErrorBox: Drafts
2008-04-02 08:48:14,370 7163 [main] INFO com.sforce.SalesforceAgent - Service imap.googlemail.com:0:xxxxxxx@googlemail.com:Inbox successfully registered
2008-04-02 08:48:14,370 7163 [main] INFO com.sforce.SalesforceAgent - com.sforce.mail.EmailService loaded as a timer service.
2008-04-02 08:49:29,268 82061 [Timer-0] ERROR com.sforce.mail.GenericClient - Unable to connect to mail service.
Service: imap.googlemail.com
User: xxxxxxx@googlemail.com
Message: Operation timed out;
nested exception is:
java.net.ConnectException: Operation timed out
@ak: Please confirm you have enabled IMAP on Gmail; also, can you post both your config files? (hide usernames/passwords)
In the sfdcConfig.txt file you’ll need to append a security token to the end of your password for the service to successfully log into Salesforce.
Nice summary. Thanks.
Reply to “Using Email2Case with Google’s Gmail”