You need to sign in to do that
Don't have an account?
Benjamin Viertel
EmailManager.sendMail success but no Email arrives
Doing the Beginner Dev: https://trailhead.salesforce.com/content/learn/modules/apex_triggers/apex_triggers_intro?trail_id=force_com_dev_beginner
Sendmail is working with "success" in console. But no mail arrives. I tried with two email adresses.
Sendmail is working with "success" in console. But no mail arrives. I tried with two email adresses.
Where exactly are you trying to give the email address ? I assume you are giving it on the trigger ExampleTrigger in line 5 like below.
Also verify if you have class with EmailManager and method sendMail as in the module link https://trailhead.salesforce.com/en/content/learn/modules/apex_database/apex_database_intro which sends an email to the address specified.
If eveyrthing is fine you may have to check email develiverability settings in the setup -> Check Setup | Email Administration | Deliverability | Access level?
Also check your spam or junk folders for the email.
Hope this helps! Please mark as best if it does
Thanks
- access level: all
- activate bounce management checked
- enable compliance with standard email security mechanisms
- log activities
- TLS setting: preferred
Did you check your spam or other folders where you usually see the salesforce emails. Also try checking the email log files. Setup-> Email log files ->Request for the email ids to which you tried sending the triggered email.
If your issue persists please paste your trigger and class as a response.
Thanks
Normally, I get all the salesforce emails fine in my incoming mailbox, not in junk or elsewhere. I get emails, when I installed a package to the cunning moose account or when package installation fails, for example.
I can not find anything in junk. I tried this with two email addresses.
I have no entries under Email Logs. I tried to request logs. I now have one pending email log request (for a period of seven days). I did not receive any email on the completion of the pending request. I also don't see a log yet. I waited several minutes.
I just came accross a trail with an email for the second time. I will post my classes from this trail. Not sure if they are the same for the original question, but the result is the same: USER_DEBUG: Email sent successfully
But no email arrived.
public class EmailMissionSpecialist {
public void sendMail(String address, String subject, String body) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {address};
mail.setToAddresses(toAddresses);
mail.setSubject(subject);
mail.setPlainTextBody(body);
Messaging.SendEmailResult[] results = Messaging.sendEmail(
new Messaging.SingleEmailMessage[] { mail });
inspectResults(results);
}
private static Boolean inspectResults(Messaging.SendEmailResult[] results) {
Boolean sendResult = true;
for (Messaging.SendEmailResult res : results) {
if (res.isSuccess()) {
System.debug('Email sent successfully');
}
else {
sendResult = false;
System.debug('The following errors occurred: ' + res.getErrors());
}
}
return sendResult;
}
}
AND Apex Code from anonymous execution window:
EmailMissionSpecialist em = new EmailMissionSpecialist();
em.sendMail('benjamin.viertel@sellmore.de', 'Flight Path Change',
'Mission Control 123: Your flight path has been changed to avoid collision '
+ 'with asteroid 2014 QO441.');
The log request finished. I can check the log. But I did not receive an email for this (which I should have). This is the line which is for the outgoing email which endet as SUCCESS in DEBUG: