6

I am using Apex SingleEmailMessage to send out an email message, and utilizing the setOrgWideEmailAddressId to make sure this e-mail appears coming from a company e-mail and not from a specific user.

If users have a personal signature set up, the signature gets appended to the bottom of the e-mail message. How to avoid this personal signature?

Apex code that send email message:

 public static void sendEmail(String subject,String body, String address, String ccAddress) {

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    String[] toAddresses = new String[] {address};
        mail.setToAddresses(toAddresses);
    if(ccAddress!=null) {
        String[] ccAddresses = new String[] {ccAddress};
            mail.setCcAddresses(ccAddresses);
    }
    mail.setSubject(subject);
    mail.setPlainTextBody(body);

    OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = '[email protected]'];
    if ( owea.size() > 0 ) {
        mail.setOrgWideEmailAddressId(owea.get(0).Id);
    }
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

}
4
  • Which users are you referring here who have personal signature? Where is that signature, is that on the email template you are using?
    – Jayant Das
    Commented May 2, 2018 at 2:49
  • We have set up signature here for users. help.salesforce.com/articleView?id=000001133&type=1
    – Kritik
    Commented May 2, 2018 at 2:55
  • What is in your email template and type of the template that you are using will help here.
    – Jayant Das
    Commented May 2, 2018 at 2:57
  • We are not using email template.
    – Kritik
    Commented May 2, 2018 at 3:05

1 Answer 1

8

SingleEmailMessage extends Email class and inherits all its method. Refer to below excerpt from the documentation.

SingleEmailMessage extends Email and inherits all of its methods. All base email (Email class) methods are also available to the SingleEmailMessage objects.

To stop sending signature as part of the email, you need to use the following method from the base Email class:

mail.setUseSignature(false);
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .