0
我曾经使用这个类发送电子邮件。但现在它不起作用。我是销售人员的新人。Salesfroce单个电子邮件发送类
List<String> Address = new List<String>();
Address.add('Email address is here');
邮件对象的代码如下:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
List<Messaging.EmailFileAttachment> allApplicantAttachments = new List<Messaging.EmailFileAttachment>();
Messaging.EmailFileAttachment applicantAttachment = new Messaging.EmailFileAttachment();
PageReference pdf = new pagereference('/apex/gernerateInvoicePdf?Id=a12m00000014ADN');
mail.setToAddresses(Address);
mail.setSubject('test');
mail.sethtmlBody('hello');
Blob b = pdf.getContent();
//mail.setBody(b);
applicantAttachment.setBody(b);
applicantAttachment.setFileName('test.html');
allApplicantAttachments.add(applicantAttachment);
mail.setFileAttachments(allApplicantAttachments);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
感谢您的答复。现在我正在收到电子邮件。 – 2015-03-10 05:32:50