function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
How to send mass email?
Hi,
Try the below code snippet as reference:
----------------vf page -----------------------------
<apex:page controller="test1" id="p">
<script>
function ff()
{
alert(document.getElementById("p:f:t").value);
}
</script>
<apex:form id="f" >
Enter email id:<apex:inputText value="{!emailid}" id="t" /><br/>
<apex:commandButton value="Send Email" action="{!SendEmailvalue}" onclick="ff()"/>
</apex:form>
</apex:page>
---------------- Apex Controller -----------------
public class test1 {
public string emailid{get;set;}
public void SendEmailvalue()
try{
List<Messaging.SingleEmailMessage> allemail = new List<Messaging.SingleEmailMessage> ();
for(Integer i=0;i<1000;i++)
string subject='your are registed'+i;
string body='welcome in sales force address'+i;
String[] toAddresses = new String[]{emailid};
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// mail.setTemplateId(emailtemp.Id);
// mail.setReplyTo(EmailAdd);
mail.setToAddresses(toAddresses);
mail.setPlainTextBody( body );
mail.setSaveAsActivity(false);
// mail.setwhatId(eMAILvtm.Contact__c);
// mail.setTargetObjectId(VTMobj.Contact__c);
allemail.add(mail);
Messaging.sendEmail(allemail,false);
catch(Exception e)
System.debug('qqqqqqqqqqq'+e);
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi,
Try the below code snippet as reference:
----------------vf page -----------------------------
<apex:page controller="test1" id="p">
<script>
function ff()
{
alert(document.getElementById("p:f:t").value);
}
</script>
<apex:form id="f" >
Enter email id:<apex:inputText value="{!emailid}" id="t" /><br/>
<apex:commandButton value="Send Email" action="{!SendEmailvalue}" onclick="ff()"/>
</apex:form>
</apex:page>
---------------- Apex Controller -----------------
public class test1 {
public string emailid{get;set;}
public void SendEmailvalue()
{
try{
List<Messaging.SingleEmailMessage> allemail = new List<Messaging.SingleEmailMessage> ();
for(Integer i=0;i<1000;i++)
{
string subject='your are registed'+i;
string body='welcome in sales force address'+i;
String[] toAddresses = new String[]{emailid};
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// mail.setTemplateId(emailtemp.Id);
// mail.setReplyTo(EmailAdd);
mail.setToAddresses(toAddresses);
mail.setPlainTextBody( body );
mail.setSaveAsActivity(false);
// mail.setwhatId(eMAILvtm.Contact__c);
// mail.setTargetObjectId(VTMobj.Contact__c);
allemail.add(mail);
}
Messaging.sendEmail(allemail,false);
}
catch(Exception e)
{
System.debug('qqqqqqqqqqq'+e);
}
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.