global class ApexScheduledClass Implements Schedulable
{
global void execute(SchedulableContext sc)
{
sendmail();
}
public void sendmail()
{// Please add your logic according to requirement
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
string [] toaddress= New string[]{'demo@gmail.com'};
email.setSubject('Testing Apex Scheduler-Subject');
email.setPlainTextBody('Testing Apex Scheduler-Body');
email.setToAddresses(toaddress);
Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});
}
}
Or like below
global class InactiveApplication implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'Select Id, Name, Owner.Email from Trade_Ally_Account__c where Stage__c = 'Prospecting' and LastModifiedDate = LAST_N_DAYS:31';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Trade_Ally_Account__c> scope)
{
EmailTemplate emailTemplate = [select Id, Body from EmailTemplate where DeveloperName = 'Update_Service_Request'];
for(Trade_Ally_Account__c ta : (List<Trade_Ally_Account__c>)scope) {
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setToAddresses(new String[] {ta.Owner.Email});
email.setSaveAsActivity(false);
email.setTargetObjectId(ta.OwnerId);
email.setTemplateId(emailTemplate.Id);
email.setWhatId(ta.Id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
}
}
global void finish(Database.BatchableContext BC)
{
}
}
Can we set up a phone call to walk through how to implement this?
Thanks,
Danielle Hensley
Office Administrator
Office: +1-843-329-7816
dhensley@phishlabs.com
Or like below