I was trying to send an email using javaMail API using my own smtp server to gmail/hotmail/etc..I put the following code to specify smtp server's settings
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host", "my smtp host");
props.put("mail.smtp.port", "my smtp host's port");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password); //my smtp server's username and password
}
});
But when I run the program..I get the error saying cannot find domain in username or something like that.
I have the username like xyz@myDomain.com..could anyone please suggest it what the error is about?? ssl/tls is not required for this smtp server.
Thanks.