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.
Related
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.
I am Using keycloak 4.5.0 v and created a realm. I have set up the login to enable forget username and verify email. In the email tab I entered
host - smtp.gmail.com
smtp port:465
username - ***#gmail.com
SSL/TLS - enabled
Authentication - enabled with username and password
But I'm still unable to connect to gmail it always pop fail to send email notification error shown:
14:53:14,070 ERROR [org.keycloak.services.resources.admin.RealmAdminResource] (default task-1) Failed to send email
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 465; timeout 10000;
nested exception is:
java.net.SocketTimeoutException: connect timed out
Any Help would be highly appreciated thank u
change smtp port to 587 i think this work and off SSl and TLS is on
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!
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
I'm using the grails mail plugin (2.0.0.RC2) with Grails 3.0.7. This is my config:
mail:
host: smtp.gmail.com
port: 465
username: myuser#gmail.com
password: myPassword
props:
- mail.debug: true
- mail.smtp.auth: true
- mail.smtp.socketFactory.port: 465
- mail.smtp.socketFactory.class: javax.net.ssl.SSLSocketFactory
- mail.smtp.socketFactory.fallback: false
When I try to send a test mail, I get the following error:
Caused by: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at grails.plugins.mail.MailMessageBuilder.sendMessage(MailMessageBuilder.groovy:131) ~[mail-2.0.0.RC2.jar:na]
at grails.plugins.mail.MailService.sendMail(MailService.groovy:55) ~[mail-2.0.0.RC2.jar:na]
at grails.plugins.mail.MailService.sendMail(MailService.groovy:59) ~[mail-2.0.0.RC2.jar:na]
at com.eduspace.ClassroomController.$tt__index(ClassroomController.groovy:13) ~[main/:na]
at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:93) ~[grails-core-3.0.7.jar:3.0.7]
at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:90) ~[grails-core-3.0.7.jar:3.0.7]
... 9 common frames omitted
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972) ~[javax.mail-1.5.1.jar:1.5.1]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:656) ~[javax.mail-1.5.1.jar:1.5.1]
at javax.mail.Service.connect(Service.java:345) ~[javax.mail-api-1.5.1.jar:1.5.1]
... 15 common frames omitted
I see no other debug information in the logs. I have the root logger set to INFO, so everything should be getting outputted. I've verified that I can telnet to smtp.gmail.com port 465, so that's not the issue. I've read that others have had issues with SSL, but then there's usually some debug information indicating an SSL issue and I don't get anything like that.
I am using a slightly different config that works fine:
grails:
mail:
host: "smtp.gmail.com"
port: 465
username: "<username>#gmail.com"
password: "<password>"
props:
mail.smtp.auth: "true"
mail.smtp.socketFactory.port: "465"
mail.smtp.socketFactory.class: "javax.net.ssl.SSLSocketFactory"
mail.smtp.socketFactory.fallback: "false"
The mail config is inside in the grails placeholder and i am not using the dashes as in your example. Maybe this could be of help to you.
This could ofcourse be wrong due to config error but one of the reason for this exact error message is gmail configuration. To avoid spam messages, gmail has started blocking access from apps that do not conform to latest security guidelines.
One easy way to avoid this error is to go to your gmail account and allow less secure apps.- https://www.google.com/settings/security/lesssecureapps
Your configuration looks good.
Here is the mine working fine:
grails {
mail {
host = "smtp.gmail.com"
'default' {
from = "<username>#gmail.com"
}
port = 465
username = "<username>#gmail.com"
password = "<password>"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
}