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