You need to sign in to do that
Don't have an account?
Admin 2567
how to set from header and e-mail in custom custom message object
Hello, We have created a custom object to inform our customers in case of any disturbance. We have defined several customer groups to send the right messages to the right customers in situations that apply for that group. For this we have created some code to select the right template. We also want to make sure that all templates alo use the right from header and e-mail address but are not able to create the right code for that. Does anybody have some tips on how to put this in to code?
I feel as if you may need to rethink your objective
1. InboundEmailServices will never receive EmailMessage.
2. (prior to Summer 16), EmailMessage is used exclusively for Email2Case and is always a child of Case. Post summer 16, the Enhanced Email feature allows for using EmailMessage for all emails sent from SFDC. Refer Help Doc (https://help.salesforce.com/articleView?id=emailadmin_enhanced_email_considerations.htm&type=5)
3. (prior to Summer 16) EmailMessage is not customizable with additional fields. Post summer 16, the Enhanced Email feature allows for customization.
So, if you are receiving emails to some address admin@mycompany.com that are being forwarded by your mail server to the configured Force.com EmailServices address (which in turn invokes an Inbound Email Services Handler), then:
1. The received email will not go into EmailMessage. Programmatically trying to put it there is nonsensical since that sobject is reserved for Email2Case.
2. You will need to save the headers/body in an object(s). Examples (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_forcecom_email.htm) with Account + Attachments + Note
Thank You,
www.nubeselite.com
Development | Training | Consulting
Please mark this as solution if your problem is solved.