Not able to send email notification using Scala in Spark Yarn Cluster mode [duplicate] - scala

I am working with Java Mail API, i am getting this strange error: "Initial Access check failure"
My configuration looks fine, URL, user, pwd, etc. Just cannot figure out why this message comes up.
550 5.7.1 Initial access check failure
DEBUG SMTP: got response code 550, with response: 550 5.7.1 Initial access check failure
RSET
250 2.5.0 Ok.
DEBUG SMTP: MessagingException while sending, THROW:
com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.1 Initial access check failure
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Initial access check failure
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2133)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1630)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1132)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at com.mrd.utilities.SendMailMessage.sendNewsMobileDeviceAlert(SendMailMessage.java:277)
at DBManager.sendLowVolumeEmailAlert(DBManager.java:241)
at DBManager.executeQuery(DBManager.java:168)
at DBManager.getConnection(DBManager.java:109)
at MainClass.main(MainClass.java:37)
Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Initial access check failure
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1637)
... 8 more
QUIT
221 2.3.0 Bye received. Goodbye.

I got this issue and resolved it by providing access to my server and sender email id on SMTP server. SMTP servers are restricted as to which server can send email from what sender email id. Contact with your SMTP administrator have them grant permission to your server ip and sender email id.

Related

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.

Client does not have permissions to send as this sender in Jenkins

I installed Jenkins (Jenkins ver. 2.46.2) and i have configured SMTP Server in Manage Jenkins -> Configure System -> Email Notification.
Test mail is works fine. But in Job email notification not working.
Error message as : Error sending to the following VALID addresses
I checked the Jenkins log file.
550 5.7.60 SMTP; Client does not have permissions to send as this sender [KL1PR03MB1749.apcprd03.prod.outlook.com]
DEBUG SMTP: got response code 550, with response: 550 5.7.60 SMTP; Client does not have permissions to send as this sender [KL1PR03MB1749.apcprd03.prod.outlook.com]
RSET
250 2.0.0 Resetting
com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP; Client does not have permissions to send as this sender [KL1PR03MB1749.apcprd03.prod.outlook.com]
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2057)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1862)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1100)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:357)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:322)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:230)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
at hudson.model.Run.execute(Run.java:1775)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:405)
QUIT
How to fix this issue?
You need to set "System Admin email address" under Manage Jenkins -> Configure System. This is under the Jenkins Location header on that page!
Have a look at below thread.
How can I set the Sender's address in Jenkins?

com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied

I am trying since yesterday but no luck. I am getting this weird error message which doesn't have much information or solution on the Internet.
A problem occurred when attempting to deliver mail.
This exception was caused by:
com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied - Invalid
HELO name (See RFC2821 4.1.1.1) ; nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 550 Access denied -
Invalid HELO name (See RFC2821 4.1.1.1) .
Code that sends email via SMTP
<cfmail
from="no-reply#example.com"
server="mail.example.com"
to="example#gmail.com"
username="no-reply#example.com"
password="password"
port=587
subject="ColdFusion Email">ColdFusion</cfmail>
I use the same server, username and password on our PHP websites using PHPMailer everything works fine only on ColdFusion websites am getting this error.
Please advise

Exim4 on server. Sending to it from another smtp. Sender verify failed

I have Exim on server with test#domain.com email.
And now i'm sending email to test#domain.com from test2#domain.com but using provider SMTP and i'm getting following error:
Failed: test2#domain.com → test#domain.com 'Microsoft Office Outlook Test Message' Server response:
550 550 Verification failed for <bounce+2db7fb.5fc31-info=test#domain.com> Unrouteable address Sender verify failed
How can i put my SMTP (sender) to white list?
Have you correctly setup your domain MX record your server ? I think there is an issues with the mx record of your domain.

How do you fix 550 must be authenticated sending Mail using Grails?

I'm using Grails Mail plugin and trying to send email and keep getting:
Error 500: Executing action [sendInvite] of controller
[RegisterController] caused exception: Failed messages:
javax.mail.SendFailedException: Invalid Addresses; nested exception
is: com.sun.mail.smtp.SMTPAddressFailedException: 550 must be
authenticated
I'm properly following the instructions at: http://www.grails.org/Mail+plugin
The mail server is returning an error when you try to send out the mail. 550 is a generic SMTP failure code; in this case it looks like you are missing a username and password. Some SMTP servers to not require authentication but most do, especially if they're publicly available on the internet. It's also possible that your SMTP server requires an SSL connection and you're connecting with an unsecured socket.
The example config for gmail shows how to set all the mail server authentication options in Config.groovy:
grails {
mail {
host = "smtp.gmail.com"
port = 465
username = "youracount#gmail.com"
password = "yourpassword"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
}
Add "mail.debug": "true" to props to turn on JavaMail debugging to get a better picture of what is happening before the failure.
In my case the 550 error was caused by me having accidentally selected and IMAP account as the default account but sending emails from my Outlook Connector Account (which has no authentication settings to make).
I changed the Outlook Connector Account to default. Resent the emails and no errors.
So check that the correct email account is set up as the default also