1

I'm trying to make a trigger fire when a Email to Salesforce message is sent(IE. email sent from gmail that has bcc address of email to salesforce address), but I'm not having luck. An email to salesforce message does not seem to trigger a 'EmailMessage' trigger.

Any tips?

1 Answer 1

3

I recommend you look at Email Services:

Receiving Email

Email services are special-purpose Force.com processes that use Apex classes to process incoming email messages. When you set up an email service, you generate a special email address on which Force.com will receive your emails. You also supply an Apex class adhering to a particular interface. The email services will then invoke a method on the Apex class whenever an email is received on the email address.

Because email services accept standard email, they open up the possibility to use any email client to interact with your applications using simple text, rather than with structured web services. Since they result in Apex logic being executed, the emails can be made to invoke any number of actions. For example, you can use anything from an iPhone to a web client to a legacy application to create invoices, launch workflows, or generate email threads.

As inbound emails can cause material business changes, Force.com allows you to enforce additional security:

  • You can limit the email senders to specific addresses or domains – Force.com will reject emails from other addresses/domains.
  • You can enable advanced security if the sender domain(s) support one or more of the protocols SPF, Sender ID, and DomainKeys. This ensures that spoofed emails do not get through.

The rest of this section shows how to set up your inbound email service and write a simple Apex class to react to incoming email. Setting up an email service is simple:

  1. Build an inbound email handler Apex class for processing the email
  2. Configure the email service, binding it to the Apex class

The article linked above goes into great detail about how to set up an Inbound Email Handler.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .