Salesforce电子邮件发送与附件增加额外的扩展名.html



我正在发送带有3个附件的电子邮件,它的工作很好,但是当附件文件大小很大时,它会在我的电子邮件中添加额外的扩展名,即test.pdf伴随着(test.pdf.html),邮件会进入垃圾邮件文件夹。下面是我的代码。

    if(strAttachFile != null && strAttachFile != '' && fileBody != null) {
        Messaging.Emailfileattachment efa1 = new Messaging.Emailfileattachment();  
        efa1.setFileName(objAttachment1.Name);        
        efa1.setbody(objAttachment1.Body); 
        fileAttachments.add(efa1);
    }
    if(strAttachFile1 != null && strAttachFile1 != ''  && fileBody1 != null) {
        Messaging.Emailfileattachment efa2 = new Messaging.Emailfileattachment();  
        efa2.setFileName(objAttachment2.Name);
        efa2.setbody(objAttachment2.Body); 
        fileAttachments.add(efa2);
        system.debug('---fileAttachments---'+fileAttachments);
    }
    if(strAttachFile2 != null && strAttachFile2 != '' && fileBody2  != null) {
        Messaging.Emailfileattachment efa3 = new Messaging.Emailfileattachment();  
        efa3.setFileName(objAttachment3.Name);
        efa3.setbody(objAttachment3.Body); 
        fileAttachments.add(efa3);
    }
    mail.setFileAttachments(fileAttachments); 
    system.debug('---mail---'+mail);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

这是由于Salesforce发送附件的方式,可能与附件的大小有关。

Salesforce自动转换超过3mb的附件并将其作为链接发送。

HTML文件链接到salesforce托管的服务器,并存储该文件30天。(作为解决方案,邮件不能通过Force.com服务器发送。)

最新更新