function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
periyaveeduleela1.287646074935periyaveeduleela1.287646074935 

Send Email functionality

Hi,

 

I have custome object, it has email field in it. I have to implement a functionality that, if my condition satisfies, I will be selecting the records and send a survey email. To send the survey email, I have to use email field which is defined in my cutom object.

 

But currently in SFDC, if I select Send Email button, in the recepients list it shows the list of contacts from contact object. how to get the recepients defined in the custom object which i have created.

 

Thanks

 

UrsfriendlyUrsfriendly
Public class sendmail
{
  public void sendpassword(string mailid ,string password)
   { 
               Messaging.SingleEmailMessage mail=new                                      Messaging.SingleEmailMessage();
               String[] toAddresses =new String[] {mailid};
               Mail.setToAddresses(toAddresses);
               Mail.setReplyTo('community@gmail.com');
               Mail.setSenderDisplayName('LMS Support  U R Password  is……..');
               Mail.setSubject('U r LMS Password is sent,check u r mail');
               Mail.setBccSender(false);
               Mail.setUseSignature(false);
               Mail.setPlainTextBody(' We r from LMS,U r LMS Password is:'+password);
               Mail.setHtmlBody(' LMS Password is:<b>'+ password +'</b>');
               Messaging.sendEmail(new  Messaging.SingleEmailMessage[] {Mail});
               
}
}
add this class code to that sendmail button action
UrsfriendlyUrsfriendly

That is one way.....

 

Other is Create Work flows on that object,Then you can get all recipients  addresses in recipients filed then u can select....

in this way u can send email .