Jenkins fails on sending emails - email

I'm trying to send email from Jenkins using Extended Jenkins Email plugin.
Here is the output of the job:
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Always
Email was triggered for: Always
Sending email for trigger: Always
messageContentType = text/plain; charset=UTF-8
Adding recipients from project recipient list
Adding recipients from trigger recipient list
Setting In-Reply-To since last build was not successful
Successfully created MimeMessage
Sending email to: tomasz.szandala#nokia.com
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "webmail-apac.nsn-intra.net", port 465, isSSL false
MessagingException message: Could not connect to SMTP host: webmail-apac.nsn-intra.net, port: 465
Sending email for trigger: Always
messageContentType = text/plain; charset=UTF-8
Adding recipients from project recipient list
Adding recipients from trigger recipient list
Setting In-Reply-To since last build was not successful
No, the question: how can I check wht is the problem?
I see only:
MessagingException message:
"Could not connect to SMTP host: webmail-apac.nsn-intra.net, port: 465"
How can I investigate the reason?

I think it's a network issue, your Jenkins server is not able to reach your SMTP server on the port 465.
Can you launch the following command to check if the port is open? (on your Jenkins server, with the jenkins account running the Jenkins app)
telnet webmail-apac.nsn-intra.net 465
If the port is open, you should see this response:
➜ ~ webmail-apac.nsn-intra.net 465
Trying XXX.XXX.XXX.XXX...
Connected to webmail-apac.nsn-intra.net.
Escape character is '^]'.
If the port is not open, try to disable the firewall on your Jenkins server.

Related

Jenkins not sending email "Got bad greeting from SMTP host"

I am trying to send an email from a Jenkins pipeline but I am getting the following error
Adding recipients from trigger recipient list
Successfully created MimeMessage
Sending email to: 1211732#isep.ipp.pt
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: need username and password for authentication
DEBUG SMTP: protocolConnect returning false, host=smtp.gmail.com, user=p-bri, password=<null>
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
DEBUG SMTP: EOF: [EOF]
DEBUG SMTP: got bad greeting from host "smtp.gmail.com", port: 465, response: [EOF]
MessagingException message: Got bad greeting from SMTP host: smtp.gmail.com, port: 465, response: [EOF]
I configured the SMTP with the following configurations
This is how I am sending the email
stage('Send confirmation email') {
emailext(
subject: "Pipeline notify - BUILD: '${env.JOB_NAME}#${env.BUILD_NUMBER}'",
body: """The pipeline runned successfully. The following tasks have been made:
- Project built
-Javadoc generation and publish
-Runned integration and mutation tests and published its respective reports
-Deployed the project to Tomcat, running at http://localhost:8888
Build can be found at: ${env.BUILD_URL}""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
to: "1211732#isep.ipp.pt"
)
}
Try the following settings. This has worked for me.

KeyCloak fails to send email using SMTP with status 500

I have Keycloak running in a Kubernetes cluster. Authentication works but I need to set up e-mail to be able to send e-mails for verification and password reset.
I have SendGrid set up as an SMTP Relay. These settings (host, port and api key) work when I send mail using the SendGrid java client. However, when pressing Test connection in KeyCloak I get:
[Error] Failed to load resource: the server responded with a status of 500 ()
[Debug] Remove message (services.js, line 14)
[Debug] Added message (services.js, line 15)
[Error] Can't find variable: error
https://<domain>/auth/resources/ong8v/admin/keycloak/js/controllers/realm.js:76 – "Possibly unhandled rejection: {}"
[Debug] Remove message (services.js, line 14)
There isn't much to go on here. I have an e-mail address set up for the currently logged in user. I've also tried resetting the password in case the Test connection functionality was broken but that didn't work either.
The Realm Settings settings user for email are as such:
host: smtp.sendgrid.net
port: 587
from: test#<domain>
Enable StartTLS: true
Username: "apikey"
Password: <api key>
Any idea what can be wrong? Or how to find out? For instance, maybe I can get a more meaningful error message somehow.
Edit:
I got the server logs.
Failed to send email: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.sendgrid.net, 587; timeout 10000;
nested exception is: java.net.SocketTimeoutException: connect timed out
Edit 2:
I've tried sending mail using Telnet using the exact same settings and that works. So apparently it's something with Keycloak or its underlying Java libraries that's causing issues sending e-mail.
Turns out that Keycloak works and that emails were blocked by the hosting provider.

not able to send the email -POP3/SMTP in blue prism

In my "Configure" action inputs (Business Object: Email - POP3/SMTP):-
Username: xxx#gmail.com
password: xxxx
POP3 Server: pop.gmail.com
SMTP Server: smtp.gmail.com
POP3 Port: 995
SMTP Port: 587
POP3 UseSSL: True
SMTP UseSSL: True
Error:- "Internal: Could not execute code stage because the exception is thrown by code stage: The SMTP server requires a secure connection or the client was not authenticated"
Tried SMTP Port: 465 and still facing an error:
"Internal: Could not execute code stage because an exception is thrown by code stage. Failure sending mail. - Unable to read data from the transport connection: net_io_connectionclosed"
You need to update you security in google
Login your google account and go to security tab there you find somewhere first Turn On Access for less secure apps in the gmail account.
Hope this will work!

Jhipster - Configuring Email with Zoho - Error 553 Relaying disallowed

I am new to Jhipster and trying to configure zoho and I am getting errors.
My setting in /myjhipsterapplicationname/src/main/resources/config/application-dev.yml
mail:
host: smtp.zoho.com
port: 587
username: ****#myCustomDomainOnZoho.com
password: ****** // My password for the above email
protocol: smtp
tls: true
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.zoho.com
Errors, I am receiving
2017-03-02 21:15:13.421 WARN 6192 --- [ints-Executor-2] com.nectotech.com.service.MailService : E-mail could not be sent to user 'asif#nectotech.com'
org.springframework.mail.MailSendException: Failed to close server connection after message failures; nested exception is javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Connection closed by remote host. Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 553 Relaying disallowed as breakpoints#localhost
I tried the following and it worked.
Go to /myjhipsterapplicationname/src/main/resources/config/application-dev.yml
Search for
mail: # specific JHipster mail property, for standard properties see MailProperties
from:
Replace the value of property from: with your SMTP outgoing email address

Pentaho DI Send Mail. Read timed out

I am trying to send an email from my Gmail account. Bellow are the SMTP details that I provided.
Server: smtp.gmail.com
Port : 465 (also tried 587) Use
Authentication: Yes
Authentication User: my full email id
Authentication password: my password
Use Secure Authentication: Yes
Secure Connection Type: SSL
This is the error that I am getting.
2016/03/16 17:35:45 - [ftp-poc].Mail - ERROR (version 5.2.0.0, build 1
from 2014-09-30_19-48-28 by buildguy) : Problem while sending message:
javax.mail.MessagingException: Could not connect to SMTP host:
gmail-smtp-msa.l.google.com, port: 465; nested exception is:
java.net.SocketTimeoutException: Read timed out
I tried these two things.
ping smtp.gmail.com - Successfull
telnet smtp.gmail.com 465 - I get a empty black screen with a cursor
blinking. No prompt or any text appears when I type. But the cursor
moves.
Gmail security - you need to authorize access by allowing "less secure" (something like that) access, from the gmail side.