function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
beaugordonbeaugordon 

Inbound Email scenario - need advice

Here's what I want to accomplish:  Configure inbound email handling so that my customers can reply by email to case comment notifiications and have their reply go into the case as a new case comment.  I want them to be able to just hit 'reply', type their message, and send it.

 

I've written the class to handle the incoming email and it's working fine.  The case notification contains a token that my class looks for so that it knows which case to add the comment to.

 

The problem is that the case notification emails I send need a replyTo address equal to the address that Salesforce gives me for the inbound email address.  It appears that this is more difficult than it should be.

 

-If the contact has a corresponding selfserviceuser enabled, then the replyTo address is the one configured in my SelvService settings (setup - configure - self-service - self-service portal - settings - edit).  If the contact does not have a corresponding selfserviceuser enabled, then the replyto address is the email address of the user who updated the case.

 

One idea is just to make sure my contacts are enabled for self-service when they open a case.  I thought I would write a trigger that enabled contacts for self-service when they open a case but that didn't work because apparently I can't create a self-service user in Apex.

 

All I want is to make it so any time a case is created or commented on, the contact gets an email that is from an email address that I can configure (like caseupdates@domain.com) so that their replies can be sent to the inbound email handler.

 

I can think of a couple of unsavory workarounds (I could enable all my contacts for self-service using the web services API, and then constantly check for new contacts and enable them with a script that runs every hour.  I could use a workflow rule to send an outbound SOAP message to another server and send the notification email from there.) I really want a solution native to Salesforce though.

 

There's probably some easy way to deal with this.  Should I be looking more at email2case?  I don't want to create cases by email.  I only want to enable customers to update existing cases.

 

 

beaugordonbeaugordon
One more thing - I know I could send the email from a trigger and specify the replyto address, but then I am going to hit problems with my daily mass email limit.