Working with Email to Case Agent in Salesforce

I have searched web for proper “Email to Case” agent tutorial but didn’t find enough information so decided to write my own one. Many of you already knows that we have “On – Demand” email to case, so what is need of this Agent? However there are existing client which are already using this toolkit and that why sometimes they need support for it.

Why Email to case Agent ?

  • Email to case agent is installed on your local/Server System. It fetches message from your email Server (Email address dedicated to Email to Case), Process it and creates Case records inside Salesforce.
  • As we know that there is limit of attachment size in Case, so using this Agent we can save that attachment on Local / Server hard drive.

Pre-requisite for Email to case Agent:

  1. JDK 1.5.0_06 or later.
  2. Email to case agent (Download from –http:// wiki.apexdevnet.com /index.php / Members : Email_To_Case )
  3. Make sure Email to Case is enabled in Salesforce.
  4. One Email Account which supports IMAP Protocol.

Now extract, Email to case agent downloaded from above URL.

In folder “EmailAgent” you will find below important 3 files:

  1. email2case.bat (To run Email-to-Case Agent we need to click on this batch file)
  2. email2case.txt
  3. sfdcConfig.txt

Configuring “email2case.txt” :

<configFile>
    <server1>
        <url>your.EmailServer.Path</url>
        <protocol>imap</protocol>
        <userName>emailtocase@YourEmail.in</userName>
        <password>YourPassword</password>
        <interval>1</interval>
        <inbox>Inbox</inbox>
        <readbox>Inbox.testNestedProcessing</readbox>
        <errorbox>Inbox.testNestedError</errorbox>
    </server1>
</configFile>
Parameter
Description
URL Name of the mail server to connect with
PORT The port to connect to on the Mail Server – optional Default port 143 will be used if not provided.
PROTOCOL IMAP, but if you want to connect to SSL encrypted IMAP Servers (like e.g. GMAIL) use IMAPS and the PORT 993, may support others in the future.
USERNAME Name of the user that will login to the mail server. Typically, the name of the email account, like platinumsupport.

Note: Exchange may require the following format – userid@domain (as opposed to server\ ame or just name.)
PASSWORD Password to authenticate the user against the mail server
INTERVAL time interval in minute to fetch message from Email Server
INBOX Name of the folder to look for new messages in
READBOX Name of the folder to move messages to after they have been processed.
ERRORBOX Name of the folder to move messages to in the event of an error. If the agent cannot successfully execute a transaction with the sfdc server, messages will be moved to this folder so that manual action can be taken if necessary (requeueing etc…).

Note: If you want to nest folder names, be sure to either use the delimiter that is supported by your mail server for separating folders(often \’/\’ or \’.\’ or you can always use \’.\’ and the agent will convert to the correct delimiter supported by your mail server at runtime.

Configuring “sfdcConfig.txt” :

<configFile>
    <sfdcLogin>
        <url>https://www.salesforce.com/services/Soap/u/9.0</url>
        <userName>SalesforceUserName</userName>
        <password>SalesforcePassword</password>
        <loginRefresh>30</loginRefresh>
        <timeout>600</timeout>
    </sfdcLogin>
    <notify>
	    <notifyEmail>jitendraZaa@gmail.com</notifyEmail>
        <from>emailtocase@JitendraZaa.com</from>
        <host>Email Server Host</host>
		<port>25</port>
        <user>emailtocase@JitendraZaa.com</user>
        <password>PasswordofEmail</password>
        <service>com.sforce.mail.SMTPNotificationAuth</service>
    </notify>
    <attachments>
        <largeAttachmentDirectory>C:\Users\JitendraZaa \Downloads \EmailAgent \Attachments \</largeAttachmentDirectory>
        <largeAttachmentURLPrefix>file:\C:\Users \ JitendraZaa \Downloads \EmailAgent \ Attachments\</largeAttachmentURLPrefix>
        <largeAttachmentSize>0.5</largeAttachmentSize>
    </attachments>
    <services>
        <com.sforce.mail.EmailService>C:\Users  \JitendraZaa\ Downloads\ EmailAgent\ email2case.txt </com.sforce.mail.EmailService>
    </services>
</configFile>
Parameter
Description
NOTIFYEMAILEmail address of person to send notification to in event of a problem. To send to multiple recipients, separate addresses by commas.
FROMSender Address of above.
HOSTSMTP Host for Email, or is using Notification extensions this can be any other type of host you need.
PORTSMTP Port for above host – optional. Default port 25 will be used if not provided.
USERFor SMTP, this is the user needed for SMTP to authenticate.
PASSWORDFor authentication, if needed.
SERVICEThe class to use for invoking notifications.

The provided class, com.sforce.mail.SMTPNotification, is for sending Email notifications via SMTP. Another class is also provided for use with SMTP servers that require authentication (e.g. Yahoo, Hosted Mail Providers).

This Class, com.sforce.mail.SMTPNotificationAuth does require the user and password parameters to be provided The architecture is designed such that another class could be used in its place for other protocols as desired SMNP, JMX etc… To do this, subclass com.sforce.mail.Notification.

Large Attachment processing:
Salesforce.com has a limit on the size of attachments for any single case. When an attachment exceeds this limit, the creation of a case for the email fails and an error is generated. To prevent this from happening, and to manage the storage of large attachments, the files can be stripped from the email they are attached to, and stored on a file system that you specify. Here are the settings that you must configure to activate this optional feature.

Parameter
Description
largeAttachmentDirectoryThis is the high level directory where you want to store the attachments. Subdirectories will be created each day an attachment is processed.
largeAttachmentURLPrefixThis is a url which will prefix a unique filename stored in a proxy file that points to the real file so that you can link to the file from the Salesforce application
largeAttachmentSizeSpecified in MB, this is the threshold at which the agent will strip attachments and copy them to disk.
Email To Case Agent Running Mode
Email To Case Agent Running Mode

Youtube Video Tutorial of Email to Case Agent :

Posted

in

by


Related Posts

Comments

20 responses to “Working with Email to Case Agent in Salesforce”

  1. […] Previous article, I have explained that how to configure Email to Case Agent for creating of cases in Salesforce. This article depicts how to troubleshoot few common problems of Email to case or On Demand Email […]

  2. Hariharasuthan Avatar
    Hariharasuthan

    Brilliant Job G2. Kudos to you

    1. JitendraZaa Avatar
      JitendraZaa

      Thanks Hari

  3. hello Avatar
    hello

    hi: thankyou for tutorial. i wanted to double check, if this method does not require any forward of emails (as the newer functionality, On Demand Email to Case, does require the company to forward all the emails to Salesforce.com) thankyou.

    1. JitendraZaa Avatar
      JitendraZaa

      Hi,
      This method requires dedicated email box. Like in above example my email address emailtocase@JitendraZaa.com will be used to fetch all emails.
      In your case it may be support@company.com.

      1. siva Avatar
        siva

        y email to case functionally is not working for forward masages

  4. Rajnish Avatar
    Rajnish

    Bro ..Could you please tell me the difference between On demand Email to Case and normal Email to Case?

    1. sudha Avatar
      sudha

      how to represent Email server path

      1. JitendraZaa Avatar
        JitendraZaa

        There is user, password and port tag in configuration. You have to represent there….

        1. sudha Avatar
          sudha

          yes i know it.but i m asking what to represent over there.Actually I dont have email server.How to create email server and how manage this?

          1. JitendraZaa Avatar
            JitendraZaa

            You will need to buy it from domain provider like go daddy. Or you can use free emails like gmail and yahoo. You can Google on information about accessing email of yahoo and gmail via coding, or client.

    2. JitendraZaa Avatar
      JitendraZaa

      On demand mean you don’t have to install anything. Out of the box functionality provided by Salesforce.

  5. Abhishek Dey Avatar
    Abhishek Dey

    Hi Jithendra.. I am not able to download email agent from the URL mentioned in your blog. Please let me know if you have any updated URL

  6. arwa Avatar
    arwa

    hii can i restrict certain email id from creating case through email to case as in the junk emails should not be automatically created into cases

  7. lfgordon Avatar
    lfgordon

    Hello – this is an excellent tutorial. I helped me understand a lot. I need to help someone that has their email hosted by Google/Gmail with their own domain name.
    Do you know how to ‘install’ the java agent in that environment? I would also love a tutorial on how to get the large attachments stored in Google Drive or somewhere outside of Salesforce.

    Thank you again

  8. CWeekes Avatar
    CWeekes

    Hi, I just found your blog. I am wondering, do you know how email and attachments created in salesforce using email to case can be stored in a company server rather than in Salesforce itself? We are encountering storage issues all the time.

    Any help is appreciated.

    Thanks!

  9. Narendra Reddy Avatar
    Narendra Reddy

    Hi jitendra, i am new to salesforce. i have done all the things based on your guidance. But in cmd running i am getting error as SMTP Authentication Request. What is SMTP host and where i can get it?

  10. Jitendra Kawale Avatar
    Jitendra Kawale

    Hi Jitendra,

    We are using Email-to-case agent. I have noticed that everyday around 3.34pm to 3.50pm new cases are not creating into Salesforce for a period of about 15-20 minutes. Suddenly, a many of cases will drop in all at once.

    can you please suggest something?

    1. Jitendra Kawale Avatar
      Jitendra Kawale

      when we checked email log, “ERROR com.sforce.mail.SMTPNotification” this was error message.

      1. Chandramohan Yetukuri Avatar
        Chandramohan Yetukuri

        Hi Jitendra,
        Thanks a lot it is a nice post and appreciate your efforts.
        Where exactly to download and install the Email-to-Case Agent? Is it in any of the developer machines?

        Regards,
        Chandra

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading