You need to sign in to do that
Don't have an account?

mail.setReferences syntax error
mail.setReferences('References: 1*<'+String.valueOf(b2bcid)+'> CRLF');
Hello guys,
if I'm using this in my outbound messages class I'm getting error as
System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_MESSAGE_ID_REFERENCE, References header is not valid.: []
Class.WPOSP.B2BRespondtoinquirycontroller.sendResponse: line 59, column 5 External entry point
in the above code String.valueOf(b2bcid) is my record id. I was wondering what will be the syntax of mail.setReferenes method.
I also looked at http://tools.ietf.org/html/rfc2822#section-3.6.4 but couldn't understand the syntax.
Could you please help me in this.
Thanks,
Vamsii
Thank You
please try a below method,
string str = '<'+recordId.left(9)+'@'+recordId.right(9)+'>';
mail.setReferences('References: 1*'+str+' CRLF');
(recordId) should be unique
Please mark the best answer if this is helpful,
thanks
I have tried with getting the pervious mail "Messageidentifer" instead of recordId, it worked as it come in to same case as loop. This doesn't work as you said when creating new email from the case when there is no previous email thread. Do you have any solution ?