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
syamkishore1.3906536981992773E12syamkishore1.3906536981992773E12 

can we send emails through apex coding?if so please let me know one sample example?

Best Answer chosen by syamkishore1.3906536981992773E12
Sri549Sri549
Hello Syamkishore1,
Sending emails to contact person or what ever it may be its very simple through Apex:

     Smalll snipet code which helps you to solve your problem.
   
   
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String Addresses -->will be having contact email id which will be stored.;
        mail.setUseSignature(false);      
        mail.setToAddresses(strAddress );
        mail.setSubject('T');
        mail.setHtmlBody('Sample Test');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

If this solves your problem
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Srinivas
SFDC Certified Developer




All Answers

Sri549Sri549
Hello Syamkishore1,
Sending emails to contact person or what ever it may be its very simple through Apex:

     Smalll snipet code which helps you to solve your problem.
   
   
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String Addresses -->will be having contact email id which will be stored.;
        mail.setUseSignature(false);      
        mail.setToAddresses(strAddress );
        mail.setSubject('T');
        mail.setHtmlBody('Sample Test');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

If this solves your problem
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Srinivas
SFDC Certified Developer




This was selected as the best answer
syamkishore1.3906536981992773E12syamkishore1.3906536981992773E12
Thanku...i got it now