I want to send a mass email to all my contacts (using the mass email wizard) but would like to have the "from" address be my organization wide address (like [email protected]).
How can I achieve that?
I want to send a mass email to all my contacts (using the mass email wizard) but would like to have the "from" address be my organization wide address (like [email protected]).
How can I achieve that?
You can set the Organization wide email address by going to: Your Name | Setup | Administration Setup | Email Administration | Organization-Wide Addresses.
Here you can add addresses and assign them to roles/profiles. When sending an email you will then have the option to select which "from" profile you would like to select.
The answer by Launa is incorrect, you cannot use an "Organization wide email address" in conjunction with Mass Mail.
Its possible to assign the same email address to multiple users though...
You could assign that email address to a user.
I think I have found a handy way to circumvent this limitation and send mass email from an organisation wide email address. This doesn't use the MassEmailMessage class, it uses the ListEmail and ListEmailIndividualRecipient tables directly. It derives from the Ojbect Reference Manual for the ListEmail object where under the field "Status" it says "Read-only except when list email is in draft state. Changing the status to Scheduled causes the list email to be sent. Valid values: Draft, Scheduled, Sent, Limit Error, Cancelled".
This got me thinking so I tried the following code.
ListEmail LE = New ListEmail(); // Create a New List Email
LE.HtmlBody = HtmlValue; // HtmlValue is the HTML email body, which can be pulled from a template
LE.Status='Draft'; // Important. Create as a draft
LE.Subject=Subject; // Set the Subject
LE.TextBody=Body; // Body is the text value of the email body
LE.Name=Subject; // Probably can use what you want here
LE.FromAddress=EmailAddress; // The verified organisation wide email address
LE.FromName=DisplayName; // Display name of the org wide email address
Insert LE; // Insert as we need the ID below
List LEIRs = New List (); // New list of recipients
For ( ID I : ListContactIDs ) // ListContactIDs - previously created list of contact ID to receive the email
{
LEIRs.Add( New ListEmailIndividualRecipient(ListEmailId = LE.ID,RecipientId = I) ); // Add contact to list
}
Insert LEIRs; // Insert recipient list
LE.Status='Scheduled'; // Set List email status to 'Scheduled' as per documentation
Update LE; // Update. This causes the List Email to be sent to all recipients. "Status" changes to Sent
The email are all sent out just as if they were list emails / mass emails.