Force.com Email Services sample code for how to unsubscribe from emails

Most companies send out marketing emails to their customers and
prospects, and need a way to allow them to unsubscribe from your email
messages. This sample code shows how you can write Force.com Email
Services to process unsubscribe requests from the email recipients.

  • The code will search in the subject line for the word “unsubscribe”
  • If the words is found, I will first find all contacts who
    matches the from Email Address and set the HasOptedOutOfEmail to true
  • Then I search though the Leads and look for the same email address and updates the HasOptedOutOfEmail to true as well
  • The code then returns true and exists

See sample code here

Published
February 19, 2008
Topics:

Leave your comments...

Force.com Email Services sample code for how to unsubscribe from emails