+ Start a Discussion
NakataNakata 

How can we receive email and based on email keyword to update object ?

Good day, 

 

Do we have chance to received any email from outside of SFDC and process the email based on some keyword to update related object's fields.

 

Thanks ! 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can do this sort of thing using an InboundEmailHandler.

 

There's information and an example in the Apex Developer's Guide at:

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_classes_email_inbound_using.htm|StartTopic=Content%2Fapex_classes_email_inbound_using.htm|SkinName=webhelp

All Answers

bob_buzzardbob_buzzard

You can do this sort of thing using an InboundEmailHandler.

 

There's information and an example in the Apex Developer's Guide at:

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_classes_email_inbound_using.htm|StartTopic=Content%2Fapex_classes_email_inbound_using.htm|SkinName=webhelp

This was selected as the best answer
NakataNakata

Thanks , this will be helpful !

 

Just one question, how can we do the testing of it ? for instance, what are the sender email address to send in for testing purposes ?

bob_buzzardbob_buzzard

You don't send an email via the real service to unit test this.

 

You'd create a test Messaging.InboundEmail instance and execute the handleInboundEmail method.

NakataNakata

Sorry Bob,

 

just want to know what are the sender email id for sender to send over when we in prod ? where to set the email id ?

bob_buzzardbob_buzzard

The sender email will be whoever is sending the email into Salesforce.  

 

For example, I use this to receive information about the previous days performance of a system.  The sender email is the email address of the user on the remote system that the email is sent on behalf of.

NakataNakata

Bob, apology for my bad language, i really means Salesforce email that user suppose to send ?

 

for instance , user A want to send to salesforce, what are the salesforce email id ?

bob_buzzardbob_buzzard

Ah, I understand.  Once you've written the email handler you have to create a service to receive the emails, via the UI.

 

Go to Setup -> App Setup -> Develop -> Email Services and click the new service button.  Once you've created the service, this will give you a large, autogenerated email address.  This is the address that you send your emails to.

NakataNakata

Thanks Bob , appreciated your guidance !