You need to sign in to do that
Don't have an account?
Mr. Karate
Send Email with apex api Messaging.sendEmail not working.
No emails are being sent in our sandbox with Apex API.
We have Email Administartion Deliverablility Access level set to All email.
We are able to get emails with Test Deliverability.
The sendEmailResult.success is true.
The only thing we haven't tried to fix this is delete the sandbox and create a new one.
I've been trying sending to multiple email account: gmail, mailinator, etc...
Any help is greatly appreciated.
Our testing Apex Code:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[] {'test@mail.com'});
mail.setSubject('test');
mail.setPlainTextBody('test plain');
mail.setHtmlBody('test heml');
List<Messaging.sendEmailResult> results = Messaging.sendEmail(new Messaging.singleEmailMessage[] {mail});
We have Email Administartion Deliverablility Access level set to All email.
We are able to get emails with Test Deliverability.
The sendEmailResult.success is true.
The only thing we haven't tried to fix this is delete the sandbox and create a new one.
I've been trying sending to multiple email account: gmail, mailinator, etc...
Any help is greatly appreciated.
Our testing Apex Code:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[] {'test@mail.com'});
mail.setSubject('test');
mail.setPlainTextBody('test plain');
mail.setHtmlBody('test heml');
List<Messaging.sendEmailResult> results = Messaging.sendEmail(new Messaging.singleEmailMessage[] {mail});
All Answers
Please check to see if the mails were sent out from salesforce and were they delivered or not: https://help.salesforce.com/HTViewHelpDoc?id=email_logs_format.htm&language=en_US
I just requested an email log. Thank you for the advice.
We are able to get the Apex API code that I posted to send email if we run the code in an Execute Anonymous Window in the Developer Console.
However, if we run the code in an Apex Controller for a visualsource page as the same administrator user, it fails.