I have setup a local SMTP server on my server machine's IIS 6.0.
I have set its Access Control to Anonymous so that no user name or password is required. The SMTP Windows service is running and I am trying the following in my server.xml to send an email:
<Resource auth="Container" mail.smtp.host="192.168.27.158" mail.smtp.auth="true" mail.smtp.port="25" name="sas/mail/Session" type="javax.mail.Session"/>
The host IP above is what I get when I run my ipconfig and look for the value IPv4 under my domain's Ethernet.
The message I get in the log is the following:
com.sas.mobiledesigner.api.services.email.impl.EmailServiceImpl -
Authentication failed; nested exception is
javax.mail.AuthenticationFailedException: failed to connect, no
password specified?
Why is the it asking for password when I have set my access control to anonymous?
Update:
After setting the value of mail.smtp.auth to false I get the following error message:
ERROR [tomcat-http--10] 2016-05-24 16:22:56,416
com.sas.mobiledesigner.api.services.email.impl.EmailServiceImpl - Mail
server connection failed; nested exception is
javax.mail.MessagingException: Could not connect to SMTP host:
192.168.27.158, port: 25, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host:
192.168.27.158, port: 25, response: -1
I think auth property should be false.
mail.smtp.auth="false"
Related
I've implemented the email manager using JavaMailSender into my Java application, configured with Gmail email, and locally tested.
I'm using a free domain by freenom.
in localhost on my pc everything working perfectly. But deploying on the server the application obtains this error:
c.m.a.m.components.EmailManager : sendRegisterEmail Exception: Mail server connection failed;
nested exception is com.sun.mail.util.MailConnectException:
Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com. Failed messages:
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
test done
Generating an application password
Using directly the host IP
Using port 465 and 25
Disabling VPS firewall
Used another mail provider
application.properties
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=***********#gmail.com
spring.mail.password=***********
spring.mail.properties.mail.debug=false
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.mime.charset=UTF-8
spring.mail.transport.protocol=smtp
Try to change spring.mail.port to 465. This might help.
Port 587 is technically correct. However, many ESPs have adopted implicit TLS on port 465.
Also, there's probably a firewall preventing you from connecting directly, you may need to connect through a proxy.
I am using java, and wilfly 17 running on ubuntu 18 and would like to send an e-mail via localhost / a remote host, i.e. gmail, using this server.
I have implemented the solution described in
send mail via localhost
and then tried implementing the solution described in
send mail via remote host
But, unfortunately, in both cases I am getting one and the same exception
Couldn't connect to host, port: localhost, 25; timeout -1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
at javax.mail.api#1.6.2//com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
at javax.mail.api#1.6.2//com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
respectively:
Couldn't connect to host, port: mail.google.com, 25; timeout -1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.google.com, 25; timeout -1;
nested exception is:
java.net.ConnectException: Connection timed out (Connection timed out)
at javax.mail.api#1.6.2//com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
at javax.mail.api#1.6.2//com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
at javax.mail.api#1.6.2//javax.mail.Service.connect(Service.java:388)
Regarding allowing outbound connections on my Ubuntu system, I have allowed all outbound connections as described in
allow inbound/ outbound connections Ubuntu
I just have tried sending an email through WildFly 17 running on Windows 10, but I am getting the same exception as above:
(default task-6) Couldn't connect to host, port: mail.google.com, 25; timeout -1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.google.com, 25; timeout -1;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at javax.mail.api#1.6.2//com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
at javax.mail.api#1.6.2//com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
at javax.mail.api#1.6.2//javax.mail.Service.connect(Service.java:388)
Thank you guys for your comments!
Ultimately I solved the problem by following exactly the steps listed here:
Configure WildFly to send eMails
then, after having recieved the exception
javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8
I logged on into my gmail account, on behalf of which I wanted to send e-mails, and enabled the option in this link:
Enable less secure apps gmail
Then I tested my solution on both Ubuntu 18.04 and Windows 10 and it worked in both cases!
Have the following mail configuration settings :
mail.smtp.host=smtp.us.deloitte.com
mail.smtp.socketFactory.port=25
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.auth=true
mail.smtp.port=25
and the following properties :
mail.password=password
mail.from=sam#xyz.com
mail.to=sam#xyz.com
mail.subject=Status of Data pushed
I get the following error :
java.lang.RuntimeException: javax.mail.MessagingException: Could not connect to SMTP host: smtp.us.deloitte.com, port: 25;
nested exception is:
java.net.SocketException: Permission denied:
The same code when I use gmail as the 'from' account and the Outlook account in 'to', it works.
I tried setting setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true, also disabled iPv6 on Windows 7 box, but nothing seems to work
Just an observation: You are using STMPS protocol, and most SMTPS servers still communicates on the deprecated port 465 or the standardized port 587 and not 25.
I tried this tutorial and after entering with admin as in step 8, I got the error as follows:
HTTP Status 500 - Exception while making the decision : org.apache.axis2.AxisFault: Connection refused: connect
org.wso2.carbon.identity.entitlement.filter.exception.EntitlementFilterException: Exception while making the decision : org.apache.axis2.AxisFault: Connection refused: connect
org.wso2.carbon.identity.entitlement.filter.EntitlementFilter.doFilter(EntitlementFilter.java:191)
1)
Is your WSO2 Server running against loclahost only or is it just running on his IP adres? Looks like you are not able to contact the server through this IP and/or port number.
2)
Are there any proxies defined? If so, try to disable them.
I am getting this error while trying to send mail through java mail. It used to work for me, but recently I switched to jdk7 and glassfish 3.1.2. I tried to switch it back to jdk6 also but it's not working anymore, here is the error I'm getting:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.illumina.com, port: 25;
nested exception is:
java.net.SocketException: Permission denied: connect
Telnet and ping to this server is fine. Its working from other systems. Only my local setup is throwing this error.
Any ideas?