I have a problem with email service in apex. When I reply to the salesforce generated email address, then in my email service handler the body contains all the previous replies and main email body(when the email was sent first time) along with the current reply.


Test Notessssss......

On Mon, May 4, 2015 at 11:58 AM, Pankaj <pankaj@gmail.com> wrote:

My reply body is Test Notesssssss..... only. But in email service handler I am getting the previous one as well.

Can someone suggest me how we can avoid the previous thread bodies?

Thanks in advance!


When faced with this problem, I added code in my Apex InboundEmailHandler class to

  • Examine the subject and if it started with Re or Fwd I would just ignore (i.e. "eat") the message
  • Depending on the application, I might use some other filters on subject or sending email address to also ignore the message.
  • So, you mean to say that you did no processing on the incoming email, right? And you sent a email back to the user to enter the actual content only ie. by removing the previous bodies. – Pankaj Ganwani May 7 '15 at 10:55
  • Hmm, what I meant to say was that the inboundemailhandler was designed to process the original message sent to myUsefulService@mycompany.com and, if the message was sent again via some reply or fwd, that I would ignore the subsequent receipt within the inboundemailHandler (by essentially dropping through the logic) – cropredy May 7 '15 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.