public class EmailNotify
{
public static void SendEmail(Contact[] con)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
for (Contact c:con)
{
if (DAY(TODAY()==15)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('Subject');
email.setReplyTo('whoever');
email.setSaveAsActivity(false);
email.setPlainTextBody('Text body');
String[] toAddresses = new String[] {'sampath@thylaksoft.com'};
email.setToAddresses(toAddresses);
Messaging.SendEmailResult[] sendResult;
//send the eMail
sendResult = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
}
}
}
}
public void SendEmail()
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId(con.Id);
mail.setTemplateId('00X90000000QHUD');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
public class EmailNotify
{
public static void SendEmail(Opportunity[] opp)
{
for (Opportunity o:opp)
{
// select id from opportunity where CreatedDate < THIS_WEEK
Date obj = Date.today();
Integer n = FLOOR(TODAY());
if (n = 10)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('Subject');
email.setReplyTo('whoever');
email.setSaveAsActivity(false);
email.setPlainTextBody('Text body');
String[] toAddresses = new String[] {'sampath@thylaksoft.com'};
email.setToAddresses(toAddresses);
Messaging.SendEmailResult[] sendResult;
//send the eMail
sendResult = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
}
}
}
}
public class EmailNotify
{
public static void SendEmail(Contact[] con)
{
for (Contact c:con)
{
//Date obj = Date.today();
//Integer n = DAY(TODAY());
DateTime t = DateTime.now();
t = t.addDays(1);
if (t != null)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSubject('Subject');
email.setReplyTo('whoever');
email.setSaveAsActivity(false);
email.setPlainTextBody('Text body');
String[] toAddresses = new String[] {'sampath@thylaksoft.com'};
email.setToAddresses(toAddresses);
Messaging.SendEmailResult[] sendResult;
//send the eMail
sendResult = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
}
}
}
}
No comments:
Post a Comment
Share your Comments .............