Think. Build. Salesforce Solutions.

Salesforce Consulting Services across Salesforce Clouds & Across App Lifecycles

Blog

How to Integrate Amazon Simple Email Service (SES) with Salesforce?

By |2023-05-01T07:26:40+00:00April 25th, 2023|

Integrating Amazon Simple Email Service (SES) with Salesforce can help businesses streamline their email communication with customers. SES can be used to send personalized, transactional emails to customers, while Salesforce can be used to manage customer data and track communication.

1. Steps to integrate Amazon Simple Email Service (SES) with Salesforce Lightning Web Component (LWC) :

  • Visit AWS and then click on the “Create an AWS Account” button at the top right corner of the page.
  • Need to fill your personal information, including your name, email address, and password.
  • Choose whether you want to sign up as an individual or as a business.
  • Enter your billing information, including your credit card number and billing address.
  • Choose a support plan. You can choose between basic (free) or developer, business, or enterprise support plans with varying costs.
  • Read and accept the AWS Customer Agreement, which outlines the terms and conditions of using AWS services.
  • Verify your account by providing a valid phone number, which AWS will use to send you a verification code.
  • Enter the verification code you received via text message or phone call to complete the verification process.

2. Create a Salesforce account

  • Visit Salesforce and then click on the “Try for Free” button at the top right corner of the page.
  • Select the type of Salesforce account you want to create. You can choose between Salesforce Essentials, Salesforce
  • Professional, Salesforce Enterprise, or Salesforce Unlimited.
  • Fill in your personal information, including your name, email address, and company name.
  • Choose a username and password for your account.
  • Enter your phone number and select your country of residence.
  • Check the box to agree to the terms and conditions of using Salesforce.
  • Click on the “Sign me up for a free trial” button to create your account.
  • Follow the prompts to set up your account, including configuring your security settings and setting up your organization’s information.

3. Basic knowledge of AWS and Salesforce

AWS: AWS documentation
Salesforce: Salesforce documentation

Here are the steps for Integrating Amazon Simple Email Service (SES) with Salesforce Lightning Web Component (LWC) Using SDK:

Step 1: Create an Amazon SES account:

Amazon SES is a cloud-based email service that enables businesses to send emails securely and reliably. SES provides several features such as email sending, receiving, and managing email addresses. SES is also cost-effective, and you only pay for what you use. With SES, you can send transactional emails, promotional emails, and newsletters.

Here’s how to Create an Amazon SES account:

  • Once you open an AWS account
  • Go to the SES console and create an SES account.
  • Follow the instructions in the console to verify your email address.
  • Configure your SES account.

Step 2: Create an SMTP Credentials:

SMTP (Simple Mail Transfer Protocol) is a standard protocol used for sending and receiving email messages. To send an email using SMTP, you need to have SMTP credentials. These credentials are a set of login credentials that are used to authenticate and authorize the user to access the SMTP server.

Here’s how to Create an SMTP Credentials:

Go to AWS (SES) Console. Click on SMTP Setting and go on Create SMTP Credentials. Copy some details like as SMTP Endpoint, SMTP Username, and SMTP Password.

Step 3: Create Access keys:

Amazon Web Services (AWS) provides access keys that allow users to securely access and manage their resources programmatically. AWS access keys consist of an access key ID and a secret access key. The access key ID is used to identify the user or application that is making a request, and the secret access key is used to sign the request to ensure that it is authentic.

Here’s how to Create Access keys:

  • Go to Identity and Access Management (IAM) (Link) page.
  • Create Access keys and copy your access key and secret access key for future reference.

Step 4: Uploading AWS SDK to Salesforce:

  • Download AWS SDK from here aws-sdk and upload it as a static resource – awsjssdk.

Step 5: Create a Remote Site Details

  • Creating a Remote Site Setting in Salesforce is an essential step when you want to connect to an external system or service from Salesforce.

Here’s how to Create a Remote Site Details:

  • From Setup, enter “Remote Site Settings” in the Quick Find box and select “Remote Site Settings.”
  • Click the “New Remote Site” button.
  • In the “Remote Site Name” field, enter a name for the remote site. Example: Amazon AWS
  • In the “Remote Site URL” field, enter the URL of the external system or service you want to connect to. (http://s3.amazonaws.com) .
  • In the “Active” field, select “Active” to enable the remote site or “Inactive” to disable it.
  • Click the “Save” button to save the remote site setting.

Step 6: Create a Content Security Policy Trusted Sites

Content Security Policy (CSP) is a security feature in web browsers that helps prevent cross-site scripting (XSS) attacks by restricting the types of content that a website can load or execute.

Here’s how to Create a Content Security Policy Trusted Sites:

  • From Setup, enter “ CSP Trusted Sites” in the Quick Find box and select “CSP Trusted Sites”.
  • Click the “New Trusted Sites” button.
  • In the “Trusted Site Name” field, enter a name for a trusted site. Example:Amazon
  • In the “Trusted Site URL” field, enter the URL of the external system or service you want to connect to (https://email.ap-south-1.amazonaws.com)
  • Select the checkbox of the Allow site for style-src, Allow site for media-src, Allow site for img-src Allow site for font-src Allow site for connect-src, Allow site for font-src
  • Click the “Save” button to save the trusted site.

Step 7: Create an LWC component.

Salesforce Lightning Web Component (LWC) is a modern web component framework that enables developers to build fast, reusable, and efficient web components. LWC is built on top of modern web standards such as Web Components, ECMAScript 6, and Shadow DOM. LWC provides several features such as Lightning Data Service, Lightning Message Service, and Lightning Base Components.

Here’s how to Create an LWC component name: bulkEmail:

Integrate Amazon Simple Email Service (SES) with Salesforce

Step 8: Import the SES library.

Import the SES library into your LWC component by adding the following code:

Integrate AWS with Salesforce

This code imports the AWS SDK , initializes the SDK with your SES configuration, and creates an SES instance.

Step 9: Send an email

To send an email, add the following code to your LWC component.

Integrating Amazon Simple Email Service (SES) with Salesforce

This code creates a params object that contains the email recipient, email body, email subject, and email sender. The sendEmail() function then uses the SES instance to send the email by calling the sendEmail() method and passing the params object. The callback function logs any errors or data returned by SES.

Step 10: Test the LWC component.

Save your LWC component file and deploy it to your Salesforce org. Add the BulkEmail component to a Lightning page and click the “Send Email” button to send a test email.

Summary:

Integrating Amazon Simple Email Service (SES) with Salesforce can be achieved using the Amazon SES SMTP interface and configuring the Salesforce Email Relay Settings. While the process may require some technical knowledge, it can be considered a relatively straightforward way to integrate the two services.

 

 

Leave A Comment