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

SingleEmailMessage not working properly.
Hi,
I just want to send a single mail with an attachment, I have written something like this
Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage(); String toAddresses = 'ashishborate@xyz.com'; List<String> addr = new List<String>(); addr.add(toAddresses); String subject ='Account CSV'; email.setToAddresses(addr); email.setSubject(subject); email.setPlainTextBody('Account CSV'); email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc}); email.emailPriority='low'; System.debug('Sending Email @@ '+email); Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); System.debug('SendEmailResult @@ '+r);
Where, debug gives me, but I am not getting any mail. Kindly help.
SendEmailResult @@(Messaging.SendEmailResult[getErrors=();isSuccess=true;]
Thanks,
Ashish.
Where is your code placed?
There are limitations on whether or not Emails are sent out. I think I had my code in the constructor and had to move it somewhere else. It worked perfectly once I did.
if running in a testmethod, emails are never sent out; you need to test via the UI
Hi,
I have written this code in one method named 'send()' in apex class, and calling that method through constructor.
Are there any ORG related settings to be done? (like, bounce, relay etc.)
Stuck on this, please help me out.
Thanks,
Ashish.
is this your valid email Address : ashishborate@xyz.com
Please confirm ,and also check emails in Junk /Spam Folders as well .
Warm Regard,
Hi Mayank,
This is not my original id.
The id I have stated in my code, is not showing any incoming mails sent through this code.
I have checked all possible places where it can get delivered, also tried the same, with 3 different email-ids.
:(
But, of no use.
Thanks,
Ashish.
Hi Ashish,
Is it help full to you. i dont know but it is working file for multiple emails to send attachments
try it !
hmm
the field email.priority is not even documented in the Apex developer documentation. When I tried in execute anonymous, I get an NPE