You need to sign in to do that
Don't have an account?
Neoxia 7
SendEmail not working in Sandbox
Hi,
In a sandbox, I would like to send an email to some users when a particular action is done (i.e. in a trigger on a custom object).
First of all, I configured the access level to "All Emails" in Email Administration > Deliverability.
Then, I use the classic Messaging class/namespace in my trigger :
I also logged the number of sent emails with "Limits.getEmailInvocations()". It always increases...
In some forums, I read that it could be a problem with the sandbox (https://developer.salesforce.com/forums/ForumsMain?id=906F000000091ECIAY). Any idea or experience here ?
Thanks !
In a sandbox, I would like to send an email to some users when a particular action is done (i.e. in a trigger on a custom object).
First of all, I configured the access level to "All Emails" in Email Administration > Deliverability.
Then, I use the classic Messaging class/namespace in my trigger :
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); //Test toAddresses = new List<String> {'some.email@test.com'}; mail.setToAddresses(toAddresses); mail.setReplyTo('no-reply@test.com'); mail.setSubject('subject'); mail.setPlainTextBody('Test message... Again.'); mail.setHtmlBody('Test message... <br/> <i>Again</i>.'); Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }, false); System.debug('Email invocations : ' + Limits.getEmailInvocations()); //errors List<Messaging.SendEmailError> errors = new List<Messaging.SendEmailError>(); for(Messaging.SendEmailResult currentResult : results) { System.debug('Success : ' + currentResult.isSuccess()); }In my debug logs, I clearly read "Success : true" for each mail this function has to send. But in my mailbox, nothing to read.
I also logged the number of sent emails with "Limits.getEmailInvocations()". It always increases...
In some forums, I read that it could be a problem with the sandbox (https://developer.salesforce.com/forums/ForumsMain?id=906F000000091ECIAY). Any idea or experience here ?
Thanks !
It it can't be modified, how to test mail sending before going to production env ?