+ Start a Discussion
Lee_CampbellLee_Campbell 

Deploying an inbound mail handler...

I'm trying to set up a service that generates an email and then uses the contents of the response to update a field. To do this, I set my mail.replyTo address on the outbound message as the huge auto-generated inbound mail handler address. Later, staring into the fridge thinking about what I wanted on my sandwich, it dawned on me that, when I try to deploy that into a production environment, it's not going to work, because the email address will be different. Any clues as to how I get round that?

 

Thanks,

Lee

Best Answer chosen by Admin (Salesforce Developers) 
crop1645crop1645

Lee

 

Use a Custom Setting --- the production instance can be set to the production inbound email service address; the sandbox instance can be set to the sandbox inbound email service address.

 

That said, those inbound email service addresses are messy to read so you might want to set up an alias in your email system that auto-forwards to the sfdc inbound email address (plus you can use your own domainrather than a salesforce.com domain)

All Answers

crop1645crop1645

You need to create an inbound email service on both production and sandbox; they will have different generated email addresses. However, both email services will refer to the same APEX inbound email service class

Lee_CampbellLee_Campbell

Thanks for your reply.

 

I appreciate that they will refer to the same inbound email class, but I want to force the "replyTo" address to be that of the inbound message handler. How can I do that? In the replyTo method, what argument can refer generically to this inbound message handler email address?

crop1645crop1645

Lee

 

Use a Custom Setting --- the production instance can be set to the production inbound email service address; the sandbox instance can be set to the sandbox inbound email service address.

 

That said, those inbound email service addresses are messy to read so you might want to set up an alias in your email system that auto-forwards to the sfdc inbound email address (plus you can use your own domainrather than a salesforce.com domain)

This was selected as the best answer
Lee_CampbellLee_Campbell

Good plan, Eric. Thank you! I shall do just that.

 

Lee