• ChrisS_SFDC
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 10
    Replies

I've seen a number of posts recently for advice on how to extend the functionality of Email To Case in order to provide some specific functionality that isn't currently provided.  For example, several people have asked how they can set the name or email address of the email sender on the Case if the contact is not found.  Others have said they do not want Activities created for all Emails being attached to Cases and would like for these to be suppressed.  While I understand that these are features that may be in the works for future releases, it is not too difficult to add this functionality yourself today using the Partner API.

 

To get started, you will need to open the Email Agent project in eclipse (or any other Java IDE you are familiar with, but the distribution includes an eclipse project specification).  In my example I have chose to add a new package and class in order to keep this code separate from the core Email To Case code.  I’ve called it com.sforce.support.CaseProcessor.java. 

 

The CaseProcessor class will utilize the Partner API to retrieve all the cases that have been created by the Email Agent for a call to handleEmailMessage.  The constructor here accepts the existing SOAP binding as well as the returned SaveResult array in order to retrieve the necessary API Objects.

 

Note that the SaveResult array returned from handleEmailMessage is returning the result of creating Case and EmailMessage objects, the Ids included are those of the EmailMessages.  In order to retrieve the corresponding cases, it is neccessary to retrieve the Email Objects first, find their Parent Ids, and then use these Ids to retrieve the Case Ids. 

 

The CaseProcessor has a couple of methods used to illustrate functionality that is possible through the API.  For example, the setContactInfo class will retrieve a Case object and then check to see if the Case has a contact or not.  If there is no Contact for the Case, the sender of the email corresponding to this case will be used to set the Sender Email and Sender Name fields.

 

Another example is the deleteAllActivities method that will remove all of the Activities that were created by the handleEmailMessage call.  This is handy if you don’t want to use these activities and don’t want to go through the trouble of closing them manually.

 

In order to integrate this functionality with the Email Agent, it is necessary to add some code to the GenericClient class included in the Email To Case distribution.  In the handleMessage method an instance of CaseProcessor is instantiated passing in the binding and the results of the handleEmailMessage call.  While looping through the results of the messages, a call to the caseProcessor setContactInfo method is made for every message that was processed successfully.  Finally, the deleteAllActivities method is invoked and then the save method is called to update the cases that were updated during the looping through email messages results.

 

Here is what this looks like, though your GenericClient code might look slightly different than mine:

 

Code:

. . .
        try {

            //SOAP API call to handle loading batch of email messages into cases
            SoapBindingStub soapBinding = getBinding();
            SaveResult[] results = soapBinding.handleEmailMessage(records);
            CaseProcessor caseProcessor = new CaseProcessor(soapBinding, results);

            for (int i = 0; results != null && i < results.length; i++) {
                SaveResult r = results[i];

                postProcessParsedMessage(parsedMsgs[i], r.isSuccess());

                if (r.isSuccess()) {
                    logger.info(Calendar.getInstance().getTime().toString() + ":" + pSUCCESS +":" + i + " ID=" + r.getId() + " "+ pSUCCESS +"=" + r.isSuccess());
                    successMsgs.add(messages[i]);
                    caseProcessor.setContactInfo(r.getId(), (InternetAddress[]) messages[i].getFrom());

                } else {
                    String sMessage = r.getErrors(0).getMessage() == null — "" : r.getErrors(0).getMessage();
                    logger.error(Calendar.getInstance().getTime().toString() + ":"+ pERROR +":" + i + ": " + sMessage);
                    errorMsgs.add(messages[i]);
                }
            }

            if (readbox != null && this instanceof ImapClient) {
                inbox.copyMessages((Message[])successMsgs.toArray(new Message[successMsgs.size()]), readbox);
            }
            if (errorbox != null && this instanceof ImapClient) {
                if(errorMsgs.size() > 0) {
                    logger.info("Copying " + errorMsgs.size() + " messages to error mailbox");
                }
                inbox.copyMessages((Message[])errorMsgs.toArray(new Message[errorMsgs.size()]), errorbox);
            }

            //By now the messages are copied to either the Error box or the Processed Box, so mark them for delete.
            for (int i = 0; results != null && i < results.length; i++) {
                messages[i].setFlag(Flags.Flag.DELETED, true);
            }

            caseProcessor.deleteAllActivities();
            caseProcessor.save();

        } catch (AxisFault e) {
. . .


 
Here is the source for the CaseProcessor class:

Code:

package com.sforce.support;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.mail.Address;
import javax.mail.MessagingException;
import javax.mail.internet.InternetAddress;
import javax.xml.namespace.QName;

import org.apache.axis.message.MessageElement;
import org.apache.log4j.Logger;

import com.sforce.soap.partner.DeleteResult;
import com.sforce.soap.partner.ID;
import com.sforce.soap.partner.SaveResult;
import com.sforce.soap.partner.SoapBindingStub;
import com.sforce.soap.partner.sobject.SObject;
import com.sforce.util.TextUtil;


public class CaseProcessor {

    static Logger logger = Logger.getLogger(CaseProcessor.class.getName());

    private static final String CASE_FIELD_LIST;
    private static final String EMAIL_FIELD_LIST;

    private static final String CASE_NUM = "CaseNumber";
    private static final String SUBJECT = "Subject";
    private static final String CONTACT_ID = "ContactId";
    private static final String PRIORITY = "Priority";
    private static final String REASON = "Reason";
    private static final String STATUS = "Status";
    private static final String PHONE = "SuppliedPhone";
    private static final String COMPANY = "SuppliedCompany";
    private static final String EMAIL = "SuppliedEmail";
    private static final String NAME = "SuppliedName";

    private static final int IDX_CASE_NUM = 0;
    private static final int IDX_SUBJECT = 1;
    private static final int IDX_CONTACT_ID = 2;
    private static final int IDX_PRIORITY = 3;
    private static final int IDX_REASON = 4;
    private static final int IDX_STATUS = 5;
    private static final int IDX_PHONE = 6;
    private static final int IDX_COMPANY = 7;
    private static final int IDX_EMAIL = 8;
    private static final int IDX_NAME = 9;

    private static final String CASE_ID = "ParentId";
    private static final String ACTIVITY_ID = "ActivityId";

    private static final int IDX_CASE_ID = 0;
    private static final int IDX_ACTIVITY_ID = 1;

    private static final String[] CASE_FIELDS;
    private static final String[] EMAIL_FIELDS;

    static {
        CASE_FIELDS = new String[10];
        CASE_FIELDS[IDX_CASE_NUM] = CASE_NUM;
        CASE_FIELDS[IDX_CONTACT_ID] = CONTACT_ID;
        CASE_FIELDS[IDX_PRIORITY] = PRIORITY;
        CASE_FIELDS[IDX_REASON] = REASON;
        CASE_FIELDS[IDX_STATUS] = STATUS;
        CASE_FIELDS[IDX_SUBJECT] = SUBJECT;
        CASE_FIELDS[IDX_COMPANY] = COMPANY;
        CASE_FIELDS[IDX_EMAIL] = EMAIL;
        CASE_FIELDS[IDX_NAME] = NAME;
        CASE_FIELDS[IDX_PHONE] = PHONE;

        CASE_FIELD_LIST = TextUtil.arrayToString(CASE_FIELDS);

        EMAIL_FIELDS = new String[2];
        EMAIL_FIELDS[IDX_CASE_ID] = CASE_ID;
        EMAIL_FIELDS[IDX_ACTIVITY_ID] = ACTIVITY_ID;

        EMAIL_FIELD_LIST = TextUtil.arrayToString(EMAIL_FIELDS);
    }

    private SoapBindingStub binding;
    private SObject[] cases;
    private SObject[] emails;
    private HashMap emailCaseIdLookup = new HashMap();
    private HashMap emailActivityIdLookup = new HashMap();
    private ArrayList updatedCases = new ArrayList();

    public CaseProcessor(SoapBindingStub binding, SaveResult[] results) throws RemoteException {

        this.binding = binding;
        ID[] idList = new ID[results.length];
        for(int i=0; i< results.length; i++) {
            idList[i] = results[i].getId();
        }

        retrieveEntities(idList);
    }

    private void retrieveEntities(ID[] ids) throws RemoteException {

        emails = binding.retrieve(EMAIL_FIELD_LIST, "EmailMessage", ids);

        if (emails != null) {
            cases = new SObject[emails.length];
            ID[] caseIds = new ID[emails.length];
            for (int i=0; i<emails.length; i++) {
                SObject email = emails[i];
                MessageElement[] fields = email.get_any();
                ID caseId = new ID(fields[IDX_CASE_ID].getValue());
                ID activityId = new ID(fields[IDX_ACTIVITY_ID].getValue());
                ID emailId = email.getId();
                caseIds[i] = caseId;
                emailCaseIdLookup.put(emailId, caseId);
                emailActivityIdLookup.put(emailId, activityId);
            }

            cases = binding.retrieve(CASE_FIELD_LIST, "Case", caseIds);

        }
    }

    /**
     * @param target  ID of email that is attached to Target Case, this is provided in SaveResult of handleEmailMessage call
     * @param email   Email address from Message, the first one is used.
     * @return        true on success, false otherwise
     * @throws RemoteException
     * @throws MessagingException
     */
    public boolean setContactInfo(ID target, InternetAddress[] email) throws RemoteException, MessagingException {

        if (email == null || email.length <=0 || cases == null) return false;

        Address addy = email[0];
        InternetAddress from;
        if (addy instanceof InternetAddress) {
            from = (InternetAddress) addy;
        } else {
            from = new InternetAddress(addy.toString());
        }

        ID caseId = (ID) emailCaseIdLookup.get(target);

        for(int i=0; i < cases.length; i++) {
            if (cases[i].getId().equals(caseId)) {
                SObject _case = cases[i];
                MessageElement[] fields = _case.get_any();
                String contactId = getValue(fields, CONTACT_ID);
                if(contactId == null) {
                    SObject updateCase = new SObject();
                    updateCase.setType("Case");
                    updateCase.setId(caseId);
                    MessageElement[] ufields = new MessageElement[2];
                    ufields[0] = new MessageElement(new QName(EMAIL), from.getAddress());
                    ufields[1] = new MessageElement(new QName(NAME), from.getPersonal());
                    updateCase.set_any(ufields);
                    updatedCases.add(updateCase);
                }
            }
        }

        return true;
    }

    public boolean deleteActivity(ID target) throws RemoteException, MessagingException {
        ID activityId = (ID) emailActivityIdLookup.get(target);

        if(activityId != null) {
            DeleteResult[] deleteResults = binding.delete(new ID[] {activityId});
            return deleteResults[0].isSuccess();
        }

        return false;
    }

    public boolean deleteAllActivities() throws RemoteException {
        ID[] ids = (ID[]) emailActivityIdLookup.values().toArray(new ID[emailActivityIdLookup.size()]);
        DeleteResult[] deleteResults = binding.delete(ids);

        boolean returnCd = true;

        for (int i=0; i < deleteResults.length; i++) {
            returnCd &= deleteResults[i].isSuccess();
        }

        return returnCd;

    }

    public boolean reAssignCase(ID target, ID assignee) throws RemoteException, MessagingException {

        return true;
    }

    private String getValue(MessageElement[] fields, String fieldname) {
        if(fields == null || fieldname == null) return null;

        for (int i=0; i< fields.length; i++) {
            if(fields[i].getName().equals(fieldname)) {
                return fields[i].getValue();
            }
        }

        return null;
    }

    public void save() {
        try {
            SaveResult[] saveResults = binding.update((SObject[]) updatedCases.toArray(new SObject[updatedCases.size()]));
            // loop through the results, checking for errors
            for (int j = 0; j < saveResults.length; j++) {
                if (!saveResults[j].isSuccess()) {
                }
            }
        } catch (Exception ex) {
            logger.error("Error updating case information", ex);
        }
    }

}


 

I hope this is helpful to some of you,

Good luck

Trying to configure Email2Case for accessing sfdc via HTTPS through the corporate HTTP Proxy, I've added the following 4 java system properties definitions in email2case.bat: -Dhttps.proxySet=true -Dhttps.proxyHost=<proxy hostname> -Dhttps.proxyPort=<proxy port> -Dhttps.proxyType=4
 
This kind of setting works fine with any "regular Java application", but with Email2Case it simply doesn't work: a network trace shows that the proxy is not called at all - the call is attempted direclty on sfdc.com, so Email2Case simply ignores these 4 parameters.
 
Is there a way to specify the proxy to be used by Email2Case ?
 
 
  • August 17, 2006
  • Like
  • 0
I am having problems getting the EmailAgent60 working.  The jar file that comes with it runs, and my config is correct as it connects to the mail server; but I am receiving a java.lang.NullPointerException any time it tries to process an email.  I've tried sending from different mail clients and it makes no difference.  I know people are using this application, so I'm not sure what the problem is.  It's an Exchange 2003 server.

I'm a developer, but not a Java developer, so I've been struggling with Eclipse trying to get the app built and running.  I've been able to build the app and resolved an issue with the j2sdk version (1.4.2_12) it was building with.  However, when running  SalesforceAgent, I get an error from the Java VM "Could not find the main class".  The Console in Eclipse shows "java.lang.UnsupportedClassVersionError: com/sforce/SalesforceAgent (Unsupported major.minor version 49.0)"

I posted this to the OpenSource group but have gotten no replies, and since it seems to be a Java issue, thought I'd try here.  Can anyone help?

Thanks

Hi:

 

I am having problems with EmailAgent60. The software would timeout while it tries to log into my email server. There is no login problem when I use Outlook to check emails. What gives? Also, it says that I need to place the Agent behind the firewall, which firewall are we talking about here? Do I need to place the Agent onto our email server? Furthermore, is there a installation manual for Email-to-Agent?

 

            Thanks a lot!

Hi,
 
Can anbody tell me i want to make a substantial number of changes in email to case Handle Email Message say for example instead of getting attachments in EmailMessages Attachments i want to make attachments in "Case" attachements and a few more changes like filling up certain case fields with some data
 
 
Thanks and Regards
 
Sushi
"Let the knowledge flow direction doesnot matters"
  • June 13, 2006
  • Like
  • 0
Does anyone know if the Email to Case functionality will work with POP?  Our mail server does not support IMAP. 
If so, what is involved in making this work?
 
Thanks.
  • April 14, 2006
  • Like
  • 0
Hi all,
 
I have set up Email2Case and the service starts correctly, logs in, says it processes 3 messages in the folder BUT nothing actually happens - no cases are created, the emails are not moved from the "inbox" to the "processed" folders nor do I get an message in the "Error" folder.
 
The service then waits for the timer to elapse, and then shutsdown as opposed to cycling again eg as per log extract below (full log further down).
 
2006-03-07 17:35:34,269 4025 [Thread-1] INFO  com.sforce.mail.GenericClient  -    processing 3 messages
2006-03-07 17:35:35,221 4977 [Thread-1] INFO  com.sforce.mail.GenericClient  - Shutting down service next cycle...
2006-03-07 17:37:33,210 122966 [Thread-1] INFO  com.sforce.mail.EmailService  - Shutting down service...
2006-03-07 17:37:33,210 122966 [Thread-1] INFO  com.sforce.mail.EmailService  - Service: RBIRPLEX01
 
Any assistance in getting this working gratefully appreciated!
 
cheers,
 
Steve
 
********* SalesForceAgent logfile *******
 
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  - Starting EmailToCase Agent v1.05.02
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  - ============================================================================
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  -              J A V A    S Y S T E M   P R O P E R T I E S
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  - ============================================================================
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  - java.runtime.name= Java(TM) 2 Runtime Environment, Standard Edition
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  - sun.boot.library.path= C:\Program Files\Java\j2re1.4.2_11\bin
2006-03-07 17:35:30,244 0    [main] INFO  com.sforce.SalesforceAgent  - java.vm.version= 1.4.2_11-b06
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vm.vendor= Sun Microsystems Inc.
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vendor.url= http://java.sun.com/
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - path.separator= ;
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vm.name= Java HotSpot(TM) Client VM
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - file.encoding.pkg= sun.io
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.country= GB
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.os.patch.level= Service Pack 2
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vm.specification.name= Java Virtual Machine Specification
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.dir= C:\EmailAgent60
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.runtime.version= 1.4.2_11-b06
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.awt.graphicsenv= sun.awt.Win32GraphicsEnvironment
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.endorsed.dirs= C:\Program Files\Java\j2re1.4.2_11\lib\endorsed
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - os.arch= x86
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.io.tmpdir= C:\DOCUME~1\STEPHE~1\LOCALS~1\Temp\
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - line.separator=
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vm.specification.vendor= Sun Microsystems Inc.
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.variant=
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - os.name= Windows XP
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.java2d.fontpath=
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.library.path= C:\WINDOWS\system32;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.specification.name= Java Platform API Specification
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.class.version= 48.0
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.util.prefs.PreferencesFactory= java.util.prefs.WindowsPreferencesFactory
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - os.version= 5.1
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.home= C:\Documents and Settings\Myuserid
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.timezone= Europe/London
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.awt.printerjob= sun.awt.windows.WPrinterJob
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - file.encoding= Cp1252
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.specification.version= 1.4
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.class.path= Email2Case.jar
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.name= MyUserID
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vm.specification.version= 1.0
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.home= C:\Program Files\Java\j2re1.4.2_11
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.arch.data.model= 32
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - user.language= en
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.specification.vendor= Sun Microsystems Inc.
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - awt.toolkit= sun.awt.windows.WToolkit
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vm.info= mixed mode
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.version= 1.4.2_11
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.ext.dirs= C:\Program Files\Java\j2re1.4.2_11\lib\ext
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.boot.class.path= C:\Program Files\Java\j2re1.4.2_11\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_11\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_11\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_11\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_11\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_11\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_11\classes
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vendor= Sun Microsystems Inc.
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - file.separator= \
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - java.vendor.url.bug= http://java.sun.com/cgi-bin/bugreport.cgi
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.io.unicode.encoding= UnicodeLittle
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.cpu.endian= little
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - sun.cpu.isalist= pentium i486 i386
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - ============================================================================
2006-03-07 17:35:30,254 10   [main] INFO  com.sforce.SalesforceAgent  - Parsing config file: sfdcConfig.txt
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.SalesforceAgent  - Config successfully parsed
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - ============================================================================
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  -             C O N F I G U R A T I O N   P R O P E R T I E S
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - ============================================================================
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - file: sfdcConfig.txt
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - sfdcLogin:password:********
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - sfdcLogin:userName:stephen.thair-at-totaljobsgroup.com
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - sfdcLogin:timeout:4
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - sfdcLogin:loginRefresh:30
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - sfdcLogin:url:https://eu0-api.salesforce.com/services/Soap/u/6.0
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - services:com.sforce.mail.EmailService:C:\\EmailAgent60\\email2case.txt
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - notify:password:********
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - notify:service:com.sforce.mail.SMTPNotification
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - notify:user:user
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - notify:notifyEmail:ops-support@totaljobsgroup.com
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - notify:host:193.128.115.60
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - notify:from:CaseMail@totaljobsgroup.com
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.config.ConfigInfo  - ============================================================================
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.SalesforceAgent  - Loading configuration file sfdcConfig.txt
2006-03-07 17:35:30,484 240  [main] INFO  com.sforce.SalesforceAgent  - Parsing config file: C:\\EmailAgent60\\email2case.txt
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.SalesforceAgent  - Config successfully parsed
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - ============================================================================
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  -             C O N F I G U R A T I O N   P R O P E R T I E S
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - ============================================================================
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - file: C:\\EmailAgent60\\email2case.txt
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:password:********
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:userName:MyUserID
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:protocol:imap
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:errorbox:ErrorMail
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:readbox:SentCase
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:inbox:CaseMail
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:url:Server01
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - server1:interval:2
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.config.ConfigInfo  - ============================================================================
2006-03-07 17:35:30,504 260  [main] INFO  com.sforce.SalesforceAgent  - Attempting to start service com.sforce.mail.EmailService with configuration file C:\\EmailAgent60\\email2case.txt
2006-03-07 17:35:33,198 2954 [main] DEBUG org.apache.axis.TIME  - axis.Call.invoke: 1482 {urn:partner.soap.sforce.com}login
2006-03-07 17:35:33,198 2954 [main] INFO  com.sforce.mail.GenericClient  - LoginURL: https://eu0-api.salesforce.com/services/Soap/u/6.0
2006-03-07 17:35:33,198 2954 [main] INFO  com.sforce.mail.GenericClient  - Agent will connect to: https://eu0-api.salesforce.com/services/Soap/u/6.0
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  - Scheduling poll process against RBIRPLEX01
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    Port    : default
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    UserID  : MyUserID
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    Password:
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    Interval: 2 minute(s)
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    InBox   : CaseMail
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    ReadBox : SentCase
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.mail.EmailService  -    ErrorBox: ErrorMail
2006-03-07 17:35:33,208 2964 [main] INFO  com.sforce.SalesforceAgent  - Service RBIRPLEX01:0:MyUSerID:CaseMail successfully registered
2006-03-07 17:35:33,228 2984 [main] INFO  com.sforce.SalesforceAgent  - com.sforce.mail.EmailService  loaded as a timer service.
2006-03-07 17:35:34,269 4025 [Thread-1] INFO  com.sforce.mail.GenericClient  -    processing 3 messages
2006-03-07 17:35:35,221 4977 [Thread-1] INFO  com.sforce.mail.GenericClient  - Shutting down service next cycle...
2006-03-07 17:37:33,210 122966 [Thread-1] INFO  com.sforce.mail.EmailService  - Shutting down service...
2006-03-07 17:37:33,210 122966 [Thread-1] INFO  com.sforce.mail.EmailService  - Service: RBIRPLEX01
   User: MyUserID
   Parent: com.sforce.mail.ImapClient@190ef12
2006-03-07 17:37:33,210 122966 [Thread-1] INFO  com.sforce.SalesforceAgent  - Service RBIRPLEX01:0:MyUserID:CaseMail successfully de-registered 
Recently, I setup email-to-case and I think it is just about configured correctly except for one issue I am having.

When the agent polls the IMAP server to retrieve email messages it appears that they are not being marked as "read". Because of this every time the agent polls the server (every 10 minutes) the same emails keep getting pulled and sent to SF creating duplicate case of the same emails.

Question: how does the agent mark the messages so this does not occur? I thought it had to do with the testProcessing folder but I am not exactly sure how this part is suppose to function.

Any help is greatly appreciated. Thanks much.

Paul