You need to sign in to do that
Don't have an account?
Mohammed Mohiddin
Setting From Address while sending email
Hello Everyone,
How do we set From Address while sending email using messaging.SingleEmailMessage. I have got a solution which uses setOrgWideEmailAddressId to set from address,
But I want to query the record ( say the contact who logged in ) and set that as From Address.
Can Anyone help me out with this?
How do we set From Address while sending email using messaging.SingleEmailMessage. I have got a solution which uses setOrgWideEmailAddressId to set from address,
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'doNotReply@blahblah.com']; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); if ( owea.size() > 0 ) { mail.setOrgWideEmailAddressId(owea.get(0).Id); }
But I want to query the record ( say the contact who logged in ) and set that as From Address.
Can Anyone help me out with this?
Raj Vakati
I think you can able to do it like this
Mohammed Mohiddin
I have got a solution for it. I will Query the logged in user and assign it to Display Name. That is what I actually wanted.
Raj Vakati
The problem is if you query the contains against to the user if contact is not preset you will get list has no rows to assign object.