You need to sign in to do that
Don't have an account?
send two Emails at time using Visualforce Page
Hi All,
How to send two Emails at a time from inputtext field. Actually now am sending only one mail like thulasi.204@gmail.com.
But My requirement is, I need to send one or more mails at time. like thulasi.204@gmail.com,abcd@gmail.com. So, how to send two mail at time.
My code :
public class sendemailcontroller {
public String to { get; set; }
public PageReference sendmail() {
Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
list<String> mid=(new String[]{to});
mid.add(to);
mail.setToAddresses(mid);
mail.setSubject('mail Sent Successfulluy');
mail.setPlainTextBody('your case has been created');
mail.setHtmlBody( 'I am not getting this sentence '+ 'here some link is there');
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
return null;
}
}
Thanks in Advance
Thulasi
How to send two Emails at a time from inputtext field. Actually now am sending only one mail like thulasi.204@gmail.com.
But My requirement is, I need to send one or more mails at time. like thulasi.204@gmail.com,abcd@gmail.com. So, how to send two mail at time.
My code :
public class sendemailcontroller {
public String to { get; set; }
public PageReference sendmail() {
Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
list<String> mid=(new String[]{to});
mid.add(to);
mail.setToAddresses(mid);
mail.setSubject('mail Sent Successfulluy');
mail.setPlainTextBody('your case has been created');
mail.setHtmlBody( 'I am not getting this sentence '+ 'here some link is there');
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
return null;
}
}
Thanks in Advance
Thulasi
If you want to send two different emails you can do
Thanks for giving your reply. What you given logic is correct for when we are giving mails within the code. But, my requirement is, we need to give emails to input field in visulaforce page. I have one inputtext field as "Email" and command button is "Send Mail". If suppose enduser has to send 5 mails at time while enter the mails in inputfield.
Alternatively, you could enforce that the field not have any non-valid email characters and dynamically build a list of fields that would get added to a list of Strings that you would then send to.
I write a demo code in which use a text type field to store all the email id and after click on send button its send mail to all email id , i try this code on the account object , please modified this code according to your requirement.
Thanks
Gyani