---
schema_version: "1"
id: bdd405865e930a3c52ce99dde9d4c2600dd5fc13720ff35b9fcda1aabf0fc7e3
title: Email Class (Base Email Methods)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_classes_email_outbound_base.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: a4d50c96e16f2d7f1e7c64df37a2de18b9da174cccd4027d028b2cc1901d7759
description: Contains base email methods common to both single and mass email.Indicates whether the email sender receives a copy of the email that is sent. For a mass mail, the sender is only copied on the first email sent.Optional. The email address that receives the message when a recipient replies.The ID of the template to be merged to create this email. Specify a value for setTemplateId, setHtmlBody, or setPlainTextBody. Or, you can define both setHtmlBody and setPlainTextBody. Optional. The default value is true, meaning the email is saved as an activity. This argument only applies if the recipient list is based on targetObjectId or targetObjectIds. If HTML email tracking is enabled for the organization, you will be able to track open rates.Optional. The name that appears on the From line of the email. This cannot be set if the object associated with a setOrgWideEmailAddressId for a SingleEmailMessage has defined its DisplayName field.Indicates whether the email includes an email signature if the user has one configured. The default is true, meaning if the user has a signature it is included in the email unless you specify false.
---
# Email Class (Base Email Methods)

Contains base email methods common to both single and mass email.

## Namespace

[Messaging](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Messaging.htm "The Messaging namespace provides classes and methods for Salesforce notifications and email functionality.")

## Usage

![Important](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/images/icon_note_important.png)

#### Important

Sending an email by using Apex requires domain-level and user-level email verification. System-generated emails also require verification of the From email address. Email delivery fails if any of these verifications is incomplete. See [Requirements to Send Email from Salesforce](https://help.salesforce.com/s/articleView?id=xcloud.security_email_verification_requirements.htm&language=en_US&type=5).

If templates are not being used, all email content must be in plain text, HTML, or both.Visualforce email templates cannot be used for mass email.

## Email Methods

The following are methods for Email. All are instance methods.

- **[setBccSender(bcc)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm#apex_Messaging_Email_setBccSender)**  
    Indicates whether the email sender receives a copy of the email that is sent. For a mass mail, the sender is only copied on the first email sent.
- **[setReplyTo(replyAddress)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm#apex_Messaging_Email_setReplyTo)**  
    Optional. The email address that receives the message when a recipient replies.
- **[setTemplateID(templateId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm#apex_Messaging_Email_setTemplateID)**  
    The ID of the template to be merged to create this email. Specify a value for setTemplateId, setHtmlBody, or setPlainTextBody. Or, you can define both setHtmlBody and setPlainTextBody.
- **[setSaveAsActivity(saveAsActivity)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm#apex_Messaging_Email_setSaveAsActivity)**  
    Optional. The default value is true, meaning the email is saved as an activity. This argument only applies if the recipient list is based on targetObjectId or targetObjectIds. If HTML email tracking is enabled for the organization, you will be able to track open rates.
- **[setSenderDisplayName(displayName)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm#apex_Messaging_Email_setSenderDisplayName)**  
    Optional. The name that appears on the From line of the email. This cannot be set if the object associated with a setOrgWideEmailAddressId for a SingleEmailMessage has defined its DisplayName field.
- **[setUseSignature(useSignature)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_email_outbound_base.htm#apex_Messaging_Email_setUseSignature)**  
    Indicates whether the email includes an email signature if the user has one configured. The default is true, meaning if the user has a signature it is included in the email unless you specify false.

### setBccSender(bcc)

Indicates whether the email sender receives a copy of the email that is sent. For a mass mail, the sender is only copied on the first email sent.

#### Signature

public Void setBccSender(Boolean bcc)

#### Parameters

- **bcc**:
    
    Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

#### Return Value

Type: Void

#### Usage

![Note](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/images/icon_note.png)

#### Note

If the BCC compliance option is set at the organization ​level, the user cannot add BCC addresses on standard messages. The following error code is returned: BCC\_NOT\_ALLOWED\_IF\_BCC\_ COMPLIANCE\_​ENABLED. ​Contact your Salesforce representative for information on BCC compliance.

### setReplyTo(replyAddress)

Optional. The email address that receives the message when a recipient replies.

#### Signature

public Void setReplyTo(String replyAddress)

#### Parameters

- **replyAddress**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Return Value

Type: Void

### setTemplateID(templateId)

The ID of the template to be merged to create this email. Specify a value for setTemplateId, setHtmlBody, or setPlainTextBody. Or, you can define both setHtmlBody and setPlainTextBody.

#### Signature

public Void setTemplateID(ID templateId)

#### Parameters

- **templateId**:
    
    Type: [ID](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm#apex_methods_system_id "Contains methods for the ID primitive data type.")

#### Return Value

Type: Void

#### Usage

![Note](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/images/icon_note.png)

#### Note

setHtmlBody and setPlainTextBody apply only to single email methods, not to mass email methods.

### setSaveAsActivity(saveAsActivity)

Optional. The default value is true, meaning the email is saved as an activity. This argument only applies if the recipient list is based on targetObjectId or targetObjectIds. If HTML email tracking is enabled for the organization, you will be able to track open rates.

#### Signature

public Void setSaveAsActivity(Boolean saveAsActivity)

#### Parameters

- **saveAsActivity**:
    
    Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

#### Return Value

Type: Void

### setSenderDisplayName(displayName)

Optional. The name that appears on the From line of the email. This cannot be set if the object associated with a setOrgWideEmailAddressId for a SingleEmailMessage has defined its DisplayName field.

#### Signature

public Void setSenderDisplayName(String displayName)

#### Parameters

- **displayName**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Return Value

Type: Void

### setUseSignature(useSignature)

Indicates whether the email includes an email signature if the user has one configured. The default is true, meaning if the user has a signature it is included in the email unless you specify false.

#### Signature

public Void setUseSignature(Boolean useSignature)

#### Parameters

- **useSignature**:
    
    Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

#### Return Value

Type: Void