Error when sending email with jenkins

I was also struggling with this error. Here is how I resolved it.

1. Google account settings:

Go to Gmail account settings -> Forwarding and POP/IMAP -> IMAP Access -> Enable IMAP (This is to enable both IMAP & SMTP settings)

Check configuration details that are mentioned as:

  • Outgoing Mail (SMTP) Server: smtp.gmail.com
  • Requires SSL: Yes
  • Requires TLS: Yes (if available)
  • Requires Authentication: Yes
  • Port for SSL: 465
  • Port for TLS/STARTTLS: 587

(Rather than going with settings mentioned by anyone, please checkout your account for this info as settings/configurations keep on changing. )

2. Jenkins (2.121.3) settings:

Manage Jenkins -> Configure System -> Scroll down to E-mail Notification tab -> Advanced

  • Use SMTP Authentication: checked
  • User Name: <your gmail id>
  • Password: <your password>
  • Use SSL: checked
  • SMTP Port: 465
  • Reply-To Address: Optional (I left it blank. You can give any email id you want)
  • Charset: UTF-8

Enable "Test configuration by sending test e-mail", give test email id and hit "test configuration" button

NOTE:

  1. Make sure you are connected to open network (that is not antivirus protected or antivirus may block your emails). I used my phone internet instead of office internet for testing this.
  2. I didn't change any McAfee settings for doing this. Just switch your internet to open one.

I configured Jenkins with my gmail account using the settings as given in the image below.

enter image description here


There is no SMTP server running on localhost or you don't have the permission to connect to it.

Check the configuration of Jenkins.


I had similar problem couldn't send email via zoho. The configurations were: SMPT TLS Zoho Configurations I just need to change system admin address in jenkins configurations to the same one in email-notifications.

Here you can find the system admin e-mail: Manage Jenkins -> Configure System -> Jenkins Location -> System Admin e-mail address

Tags:

Jenkins