I would like to use sendmail in a docker container to send email. I was able to do this before for my own site when I used a certain script to set everything up.
When I try this now sendmail tells me Deferred: Temporary AUTH failure but the next line says Message accepted for delivery. However, the message is not sent as I use Mailgun for SMTP credentials and their logs never report the email that sendmail tries to send. I have confirmed my Mailgun credentials are still valid because I can use their REST API to send mail.
I noticed when I change the port from 587 to 465 or 25 in the sendmail.mc, it is not able to connect to smtp.mailgun.org at all. It is only when I use port 587 that I get as far as the Temporary AUTH failure. How can I resolve this authorization failure? I'm 100% sure that the correct credentials are in my /etc/mail/authinfo/auth file. I tried ending that file with "M:LOGIN", "M:PLAIN", and "M:PLAIN LOGIN", and "M:EXTERNAL" but to no avail.
How on earth do I configure sendmail to send mail with my Mailgun SMTP credentials over port 587 without this "Deferred: Temporary AUTH failure" error?
Well... I don't think I will ever use pure sendmail ever again. I ended up using ssmtp as suggested here.
I have tried with various SMTP servers but I cannot get Jenkins to send an email. I get the could not connect error - nothing else, just this error.
See the screenshot below.
Any ideas why? I am using the Jenkins docker container, firewall is off.
I do not have an email server running inside the Jenkins container. I figure I don't need one if Gmail is going to send the email for me.
Your Gmail configuration looks correct. Usually these issues come down to a firewall, but if you are sure that is not the problem it could be your Gmail account settings.
An additional configuration is required in the Gmail account from which the mail is being triggered. This step authorizes apps like Jenkins to use the Gmail account.
Gmail - Allowing less secure apps to access your account
After performing this step emails should be triggered successfully.
UNBELIEVABLE. 2 days later. Fixed.
I found that my Cloud computing provider (Scaleway) disable outgoing SMTP by default and I had to enable SMTP via their web interface. Details here.
These commands helped me to determine that outgoing SMTP was in fact as dead as a donut:
telnet smtp.gmail.com 465
openssl s_client -connect smtp.gmail.com:587 -starttls smtp
echo "Hello world" | swaks -4 --server smtp.gmail.com:587 --from user#gmail.com --to user#example.net -tls --tls-protocol sslv3 --auth PLAIN --auth-user user#gmail.com --auth-password 7654321 --h-Subject "Test message" --body -
Is it possible to use microsoft exchange server for email notifications in jenkins?
I have provided exchnage server name as smtp server, authentication details, selected ssl and added below argument to the command line
-Dmail.smtp.starttls.enable=true
but still getting the error javax.mail.MessagingException: Could not connect to SMTP host.
I'm running Jenkins 1.519 on a server with Ubuntu 13.04 and I have a problem with the e-mail notification system.
When I try to get Jenkins to send an e-mail (either the test configuration button in the manage Jenkins page, or as a build step of a job) Jenkins gives me this notification: "E-mail sent successfully", but no email is actually arriving to the recipients.
Jenkins is telling me that the e-mail notifications are working properly, but nothing is actually happening when it's supposed to. No error messages are given.
Edit:
Email settings:
SMTP server: my smtp server address
Default user e-mail suffix: -
Use SMTP authentication: check
User Name: my email username
Password: my email password
Use SSL: nope
SMTP port: 25
Reply-To Address: my email address
Charset: UTF-8
Test configuration by sending e-mail: check
Test e-mail recipient: my email address.
Edit2:
So I suppose it probably isn't necessarily a Jenkins-issue, but an issue with my server? What kind of configurations are there needed on the server side to get the email-send working? Or is the Jenkins' email-system supposed to work without hassle?
Please try to check the use SSL. Here is the Email Notification set up that's working in my system. I've also tested it in Windows, mac, and linux machines and this setup works for those systems.
Need to add proper "System Admin e-mail address" in the Configure global settings of Jenkins.
I had the same issue in Linux RedHat version 6.6 and we have found the default host and port for the SMTP is not enabled in IP table, once this is enabled it started working.
Also check if the default SMTP port is enabled in the system where jenkins is installed. This could also be the reason for failed email notification through jenkins.
I'm trying to use email sending in jenkins. I leave default values, click on 'Test configuration' button and get error:
Failed to send out e-mail
javax.mail.MessagingException: Could not connect to SMTP host:
localhost, port: 25; nested exception is: java.net.SocketException:
Permission denied: connect
at
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
at
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
What I missed? It's not working by default?
I configured Jenkins with my gmail account using the settings as given in the image below.
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
If anyone is still having issues with emails in Jenkins, a lot has changed since then.
If you have a custom domain name for g-mail and it requires a 2-step authentication to login, for example you#yourcompany.com,
SMTP server should still be smtp.gmail.com
Default user e-mail suffix should be #yourcompany.com
Because Google no longer allows you to simply use your default e-mail password to login via any outside apps, in this case Jenkins. It is a lot more secure to let Google create a custom password for Jenkins rather than turning off G-Mail's security features to allow Jenkins access to your account.
Create the App Password here:
https://security.google.com/settings/security/apppasswords
Use the generated password in Jenkins -> Configure Systems -> E-Mail Configuration
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:
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.
I didn't change any McAfee settings for doing this. Just switch your internet to open one.
There is no SMTP server running on localhost or you don't have the permission to connect to it.
Check the configuration of Jenkins.
You probably don't have SMTP running on your machine, which is the usual state for Windows or Mac servers.
To test this, use any known mail-server for that, for example - if you have a gmail account, try this:
SMTP server: smtp.gmail.com
Default user e-mail suffix: #something.something
Sender E-mail Address: your-mail#gmail.com
If planning to use the mail-notifications as part of your build-process,
it is best to set the SMTP properly, or maybe move the Jenkins/Hudson server to a machine that supports this.
Check if your provider blocks port 25.
In order to make a proper test
telnet smtp.gmail.com 25
If you receive an answer like this:
telnet: connect to address 74.125.206.108: Connection refused
You should go with smtp authentication as described in harikrishna-pai's answer
I had same issue and managed to resolved by following,
Generate Gmail App Password,
Gmail App
In Jenkins use the app password,
Jenkin's Configuration
I Had the same issue.
After witch hunting a lot, I found a solution as below:
even turn on - less secure apps, I was struggling since 6 hour.
the second option:
And go to
https://accounts.google.com/DisplayUnlockCaptcha
and click Continue.
this resolved the issue.
I had the same issue as i was using avast it blocked smtp mails so i disabled it and it worked