Jenkins is an open-source tool written in java and also have a plugin built for continuous integration and build automation purpose. It helps in automating the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery.
In this blog, we are going to learn how can we integrate an AWS simple email service with Jenkins default email notifier.
Email notifier in jenkins
Jenkins provides a default email notification tool that uses JavaMail for sending out e-mails. It is what comes default with Jenkins. It contains a default message containing the Build number and its status.
Configure AWS simple email service with jenkins e-mail Notification
To integrate SES with Jenkins email notifier we need to follow the following steps:
Step 1: Login to aws account
Firstly, visit aws website to log in to our AWS account console as a root user.
Step 2: Search for SES
Secondly, we need to go under the services section on the top menu bar and search for simple email service in this section and click on that. We redirect to AWS’s simple email service dashboard.
Step 3: Verify Email
Thirdly, the most important part is to verify the e-mail which we are using for our email notification in Jenkins. For this, we need to go under Identity Management on the left side menu and select the email addresses section on the SES dashboard. You can also verify your domain if available.
Next, we need to add and verify our email in the input section provided. So for this click on the “verify a new email address” option shown in blue color on the SES dashboard. After clicking on the option provide your email address in the pop-up input section and click on “verify this email”.
After clicking on verify button a verification link is being sent to your registered email. Next, we need to go to our email inbox and simply click on the link sent by AWS to verify the email. By clicking on this link our email has been verified and ready to go for our next step of configuration.
After verification of email, you show a “green verified” text in front of your email. Next, we go next step to configure the email notifier in Jenkins.
Step 4: E-mail notification configuration
Next, we need to go to our Jenkins dashboard to configure our email notification. After going to the Jenkins dashboard we need to go as follows:
manage Jenkins > Configure System > Email Notification
You will see the following options under the email notification section as shown in the image below:
Next, we need to fill all required options in the given section to configure our email notifier.
First, we need to add an SMTP server. For this, we need to go on AWS’s simple email dashboard, and on the left side menu under
Email sending section select SMTP settings. You will see the following screen which contains information like server name, port, authentication, etc.
Just copy the
server name address of AWS SES and paste it under the SMTP server section in the Jenkins dashboard.
Next, check the box
use SMTP authentication and we need to provide the username and password.
Username and password
For username and password, we need to go to AWS SES dashboard under SMTP setting and click on Create my SMTP credentials. After that, you will see a screen that asks for a username. So provide your email in
IAM User Name and click create.
After that, you will redirect to the credentials details and you will see here that your username and password have been created successfully. You can find your username and password under show User SMTP Security Credentials. Just copy and paste them on the Jenkins email notification section in front of the username and password section.
After that, you will be done with the username and password. Next, we need to check the “SSL option on Jenkins email notification section”.
Next, we need to provide the
SMTP port which we find on the SMTP settings page. SMTP ports maybe 25, 465, and 587.
The next step is to provide an email in
Reply-to-address the section and UTF-8 under the charset section.
Last we need to check our email service by sending a test email. So for this check the box
Test configuration by sending test e-mail and provide your
Test e-mail recipient details and send a test mail by clicking
Test Configuration the button. After the mail is sent successfully you will check your recipient email to confirm the test email.
Test email received look like as follows:
This means your email notification service has been successfully configured and can be used to send various email notifications in our Jenkins project. After that click on save and you are done with this email configuration.
Add email notification to your project
To allow your projects to send an email you need to add Post Build Action and select Email Notification from the drop-down list.
This will provide you the below interface where you can add a list of email addresses to whom the email is required to be sent.
In this blog, we learn how can we configure an AWS simple email service with Jenkins email notification to send email notifications to various teams in our project. If we add a post-build action like an email notification so we can easily send build reports and errors directly to the developer and other project members involved in the project. By this, we just automate the process of CI by sending details directly on their email without doing it manually.