• Steven Hodgkinson
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I have a custom object trigger that has a logic of sending emails to ids based on criteria. It uses email template and org wide address.

So when the record is inserted, the trigger should send emails. I am not recieving any emails. Any idea how to solve this? 

The code is as follows.

Messaging.SingleEmailMessage mail = Messaging.renderStoredEmailTemplate(emailtemplate.Id, UserInfo.getUserId(), record.Id);
                        List<string> toAddress = new List<string>{"valid address"};
                        mail.setToAddresses(toAddress);
                        mail.setSubject('test');
                        mail.setOrgWideEmailAddressId(owa.Id);
                        mail.setSaveAsActivity(false);
                        mail.setUseSignature(false);
allmsg.add(mail);  
Messaging.sendEmail(allmsg,false);

The above code is in @future method.

Not receiving any emails? how to resolve this?  is there any configuration needs to made in SF?