Apex Class
public class SendNewYearEmail implements Schedulable {
private final String recipentEmail ='enginbasturk61@gmail.com';
private final String subject ='New Year Message';
private final String body ='Happy New Year 2023! May the New Year bring you happiness, peace, and prosperity.';
public void execute(SchedulableContext SC){
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setToAddresses(new String[] {recipentEmail});
message.setSubject(subject);
message.setPlainTextBody(body);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {message});
}
}
Apex Code
SendNewYearEmail objA = new SendNewYearEmail();
System.schedule('New Year Message', '0 0 0 * * ?', objA);
Video
Video does not exists.