Salesforce:如何通知用户

时间:2012-10-09 08:03:46

标签: salesforce

我需要在预定的Apex上通知用户。如何向用户或其他表格或通知发送电子邮件?

1 个答案:

答案 0 :(得分:2)

您可以使用顶级here可用的电子邮件类。

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'user@acme.com'}; 
String[] ccAddresses = new String[] {'smith@gmail.com'};
mail.setToAddresses(toAddresses);
mail.setCcAddresses(ccAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setSubject('New Case Created : ' + case.Id);
mail.setBccSender(false);    
mail.setUseSignature(false);    
mail.setPlainTextBody('Your Case: ' + case.Id +' has been created.');
mail.setHtmlBody('Your case:<b> ' + case.Id +' </b>has been created.<p>'+
     'To view your case <a href=https://na1.salesforce.com/'+case.Id+'>click here.</a>');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });