Username: xxxxx.#hotmail.com
Password: yyyyyyyy
Pop3: pop3.live.com Port: 995 SSL: TRUE
SMTP: smtp.live.com Port: 587 SSL: TRUE (Port: 25 also not working)
These are the details I gave: POP3 settings accepted and SMTP settings throw Exception:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
I got this Exception when I try to send a mail via Java Coding.
Can any one help me for correct SMTP settings which will works to send mail.
I have Send mail using Gmail and Yahoo.
To my knowledge you only use their incoming address. For outgoing to need to use a local/private/alternate SMTP server.
I check my incoming mail on a Live account through pop3.live.com and send out through mail.{myworkdomain}.com.au
Related
I had implemented the ability to send email to Java. However, from the moment I get the following error:
DEBUG SMTP: need username and password for authentication
DEBUG SMTP: protocolConnect returning false, host=smtp.gmail.com, user=USERNAME, password=<null>
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 587, isSSL true
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1;
nested exception is:
java.net.ConnectException: Connection refused: connect
I think my code is not wrong. Because my code works well on my two colleagues' PC. (telnet smtp.gmail.com 587) command works well.
Help me please. I could not do anything for a few days because of this.
I am a beginner and I would appreciate it if you could let me know.
According to this :
"Because my code works well on my two colleagues' PC. (telnet
smtp.gmail.com 587) command works well"
i assume that you already authorize access through less secure app in the gmail account you're using, and the problem is related to your own computer.
Did you check your firewall or antivirus rules ?
While trying to use
Transport.send(message, addresses); or transport.sendMessage(message, message.getAllRecipients());
while sending mail using java, the process never ends only when I provide wrong password for my attachment file.
Tried some solutions from below links but does not help:
Link 1:
Link 2:
Interestingly, process hangs only when I am providing wrong password for the attachment. While it works when I provide correct password for the attachment. Attached file is from SFTP server.
Using gmail SMTP account to send an email:
Server domain: smtp.gmail.com
Port: 465
Secure Connection: SSL
Anyone having any thoughts will be appreciated.
I'm trying to send an email with netcat, this is what i get:
****-MacBook-Pro:~ ***$ nc smtp.gmail.com 25
220 mx.google.com ESMTP h8sm66301168eew.16 - gsmtp
Helo gmail.com
250 mx.google.com at your service
MAIL FROM: <******#gmail.com>
530 5.7.0 Must issue a STARTTLS command first. h8sm66301168eew.16 - gsmtp
what is STARTTLS command and what do i need to do with it?
STARTTLS is an extension to plain text communication protocols, which offers a way to upgrade a plain text connection to an encrypted (TLS or SSL) connection instead of using a separate port for encrypted communication.
http://en.wikipedia.org/wiki/STARTTLS
The smtp server is saying it won't accept plain text connections.
You basicaly just need to specify that you're using TLS.
Use EHLO instead of HELO. This will start 250-STARTTLS.
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'm working on a project to auto-configure a user's email server settings in Java. I am extracting the mail server from his email address and looking up the MX records of that mail server using the DirContext class with com.sun.jndi.dns.DnsContextFactory.
Then I'm opening a Socket to each server and testing them using a HELO command and checking the responses.
My problem is that this works only when I test it with the unsecure SMTP port 25. How can I use it with the secure port 465?
I tried using Secure Sockets by using
SSLSocketFactory sslsocketfactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)sslsocketfactory.createSocket(mailserver, STANDARD_SMTP_PORT);
But all connections get a timeout exception as follows
alt1.gmail-smtp-in.l.google.com. java.net.ConnectException: Operation timed out
Please help.
Further Info: I am not creating a mail client. This is to simplify the mail server settings for an already existing mail client.
SMTP-SSL (Port 465) afaik is deprecated, so instead of trying to connect to a ssl socket you'd actually connect "plaintext" on port 25 (or 587 for smtp auth connections), but send EHLO instead of HELO and see if the server supports STARTTLS which replaces the deprecated SMTP-SSL. after the client sends the STARTTLS command, the connection is encrypted, so, port 25 is not per se "unsecure"
telnet alt1.gmail-smtp-in.l.google.com 25
Trying 173.194.71.26...
Connected to alt1.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP i7si4620651lbb.76
EHLO myserver.com
250-mx.google.com at your service, [x.x.x.x]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS <<--------- this is what you're looking for
250 ENHANCEDSTATUSCODES
STARTTLS <<--- client command to actually start encrypting the traffic
220 2.0.0 Ready to start TLS
Have you authenticated the program before establishing a connection with the server . Every remote mail server will need to authenticate the machine trying to establish a socket connection . If your using javaMail library for example , you will be given options to add the username and password . You will need to find a workaround while using simple sockets in java