1

I used javamail api for sending mails. First I tried gmail smtp servers and everything was ok. But now I want to use my own mail servers (via cPanel). But there is something wrong with my properties. Can anyone help me?

Here is my properties code:

Properties props = new Properties();
props.put("mail.smtp.host", "cpanel4.onofis.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");

And here is cPanel's server informations:

Username: blabllabla@blabla.com

Password: blablablabla.

Outgoing Server: cpanel4.onofis.com

SMTP: Port 465

Authentication is required for IMAP, POP3, and SMTP.

4

1 回答 1

1

好的。我发现了问题。但仍然不知道为什么......我删除了 SocketFactory 行,它完成了。

工作代码是这样的:

Properties props = new Properties();
props.put("mail.smtp.host", "cpanel4.onofis.com");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
于 2013-09-25T14:42:08.347 回答