Gmail account authentication error while sending mail in android application - java

I am getting following error when i am trying to send message from android application with gmailapi.
"Could not connect to SMTP host: relay.jangosmtp.net, port: 465, response: -1"

Since 2015 google is not allowing "less secure apps" to connect through their SMTP port (this means you need a ssl or tls certificate).
To allow them you could try this: https://support.google.com/accounts/answer/6010255?hl=en

Related

Java.net.SocketException: Permission denied: connect in Pentaho Data Integration

I try to send an e-mail with the help of Pentaho, but something blocks my shipment. Can anyone help me? I get in the log:
2019/04/02 14:35:29 - Mail - ERROR (version 8.1.0.0-365, build 8.1.0.0-365 from 2018-04-30 09.42.24 by buildguy) : Problem while sending message: javax.mail.MessagingException: Could not connect to SMTP host: smtp..., port: 25;
nested exception is:
java.net.SocketException: Permission denied: connect
I have marked:
Use authentication? true
Use secure authentication? true
Secure connection type: TLS
There's a problem with connecting to the mail server. You need to either double check your connection info, or you need to configure your mail server to work with Pentaho. For example, if you're trying to use Pentaho with Gmail, you need to set Gmail to "allow connections from less secure applications".

Android SMTP mail sender with SSL ignore

Iam trying to use the JavaMail examples found online to send emails from my Android application using a custom SMTP server. The SMTP server does not have a valid SSL certificate, instead it uses a self signed one so when I try to connect I get an SSL Handshake exception.
I tried to use the :
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.checkserveridentity", "false");
props.put("mail.smtp.ssl.trust", "*");
properties but then I get the error:
E/SendMail(17874): Could not connect to SMTP host: {MY_SMTP_HOST}, port: {MY_SMTP_PORT}, response: -1
Any suggestions? Is there any other library that supports sending emails through SMTP?

Amazon SES Connection

I am trying to use Amazon SES mail service. I have configured settings properly, and with the credentials it is working in one of our network machine, but in other it is not working, alwayz gives ConnectException
javax.mail.MessagingException: Could not connect to SMTP host: email-smtp.us-east-1.amazonaws.com, port: 25;nested exception is:java.net.ConnectException: Connection refused: connect
Check your security groups and make sure SMTP port is open to this network or device.

Could not connect to SMTP host: {remote-server}, port: {port}, response: -1

I am trying to send mail using java mail api. But exception is come to me with above
message.
Could not connect to SMTP host: {remote-server}, port: {port}, response: -1
What`s mean "response : -1"
I can`t found this code in api manual.
A response code of -1 means that JavaMail failed to get a valid response code from the SMTP server. You can view the relevant source here.
Most likely, you either have your properties set incorrectly or you have a networking issue such as a firewall blocking the connection.
You might try enabling debug mode (session.setDebug(true)). Please post your code if you need further help.

Which hostname is required to send email to a user through a website created with Google Apps?

Our website was created with Google Apps.
My website URL is http://mydomain.com, which is pointing to http://sites.google.com/a/mydomain.com/.
I want to send email to a registered user.
I am using the Apache Commons jar to send mail to the user.
I get this error message:
Sending the email to the following server failed : http://mail.google.com/a/mydomain.com:25
I used smtpPortAddress=25 & hostName=http://mail.google.com/a/mydomain.com.
I am not spending money on email server setup, so I want to send email through our website.
Which hostname is required to send mail?
I do not know if you can use port 25, for the encrypted SMTP port you can use
Host: smtp.gmail.com
Port: 465
Authentication: Yes
Username: you#yourdomain.com
Password: #YOUR_PASSWORD#
Security: SSL
Either way, just use smtp.gmail.com with your #yourdomain.com name.
You could use any mail server to sent your mail.
But if you like to use GMail the server is smtp.gmail.com.
But you also will have to make sure you authenticate as a valid gmail user.

Categories