You need to sign in to do that
Don't have an account?
rupesh ranjan
I want to send email. But TO Address should be number of email address.
I want to send email.
But TO Address should be number of email address.
Note :- email address are not relating with any contact or Lead Object
Some sample Code plss
But TO Address should be number of email address.
Note :- email address are not relating with any contact or Lead Object
Some sample Code plss
Here is a blog.
http://www.sfdc99.com/2014/03/01/sending-emails-using-apex/
-Thanks
Ashlekh Gera
in singleEmailmessage class there is a method setToAddress() which takes a parameter of a listof address .So always it will take list of address .
Where you have a limit that you can not add more then 100 email in that list which you will assign in the to addrsssList .
Check belwo links for all methods .
https://developer.salesforce.com/docs/atlas.en-us.200.0.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm#apex_Messaging_SingleEmailMessage_setToAddresses
You need to assign like belwo . I think this will help you .
Let me know if it helps !!
Thanks
Manoj
Some sample code pls
Check with below code ,change email with your email and try to execute in developer console . Let me know if it helps !!
Thanks
Manoj
you have entered
mm@gmail.com.com','kk@gmail.com
I cant replace email id with this because this is at user end what they will enter i dont know. It will be any thing
Else create a custom lable ask them to add emails with seperated by semicolon .Add code like belwo . Your lable name should EmailList then your code wil work .
Modify your body as per your user .
Let me know in case any issue .
Thanks
Manoj
This limit is if you will hit the Email server 10 times .
Incase you are using this email inside for loop then you need to create a list like belwo and declare outside the loop . add the email inside loop and sendEmail outside the loop like belwo .
Thanks
Manoj
Public class SendEmail
{
public String subject {get; set;}
public String body {get; set;}
public String to{get; set;}
private contact order;
public SendEmail(ApexPages.StandardController controller) {
this.order = (contact )controller.getRecord();
}
public contact getOrder(){
return order;
}
public pageReference send(){
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
String[] toaddress = new String[]{};
toaddress.add(to);
email.setSubject(subject);
email.setToAddresses(toaddress);
email.setPlainTextBody(body);
email.setBccSender(true);
Messaging.SendEmailResult [] res = Messaging.SendEmail(new Messaging.SingleEmailMessage[] {email});
for ( Messaging.sendEmailResult result : res ) {
if ( !res[0].isSuccess () ) {
System.debug ( result );
}
else{
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Email Sent Successfully' );
ApexPages.addMessage(msg);
}
}
return null;
}
public SendEmail(){
body = apexpages.currentpage().getparameters().get('att');
}
}