You need to sign in to do that
Don't have an account?
VRK
Error Occurred: An Apex error occurred: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email address is invalid: null: [toAddresses, null]
When i execute this code getting below error , pls check and let me know if i did anything wrong in my code below :
Error Occurred: An Apex error occurred: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email address is invalid: null: [toAddresses, null]
I verified, Email address already exists for 'Approver_email__c' ...But not sure , why this error coming ....any ideas and let me know is anything wrong on my code
******************************************************************
public class EmailNotification {
public string toAddress{get;set;}
public string message{get;set;}
@InvocableMethod
public static void sendingEmail(){
Level_Agreement__c sla = new Level_Agreement__c();
Case c = new Case();
if(c.Task_Category__c == sla.Task_Category__c)
{
Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
String[] toAddresses =new List<String>{sla.Approver_email__c};
semail.setToAddresses(toAddresses);
semail.setSubject('Testing email through apex');
semail.setBccSender(false);
semail.setUseSignature(true);
semail.setPlainTextBody('Dear User, Request for Process Reviewer notification mail ');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { semail });
}
}
}
pls let me know if i did any wrong in the code .......Thanks
Sekhar
Error Occurred: An Apex error occurred: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email address is invalid: null: [toAddresses, null]
I verified, Email address already exists for 'Approver_email__c' ...But not sure , why this error coming ....any ideas and let me know is anything wrong on my code
******************************************************************
public class EmailNotification {
public string toAddress{get;set;}
public string message{get;set;}
@InvocableMethod
public static void sendingEmail(){
Level_Agreement__c sla = new Level_Agreement__c();
Case c = new Case();
if(c.Task_Category__c == sla.Task_Category__c)
{
Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
String[] toAddresses =new List<String>{sla.Approver_email__c};
semail.setToAddresses(toAddresses);
semail.setSubject('Testing email through apex');
semail.setBccSender(false);
semail.setUseSignature(true);
semail.setPlainTextBody('Dear User, Request for Process Reviewer notification mail ');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { semail });
}
}
}
pls let me know if i did any wrong in the code .......Thanks
Sekhar
Try this code I think this will help you.
Regards,
oyab
Soyab