为什么我无法使用Zimbra邮件的Gmail配置?

时间:2016-12-21 08:18:02

标签: java gmail-api email-client zimbra

我有使用Gmail邮件服务发送电子邮件的gmail配置脚本,这些代码可以正确发送电子邮件:

public static void sendEmail() throws AddressException, MessagingException {
    String emailBody = "This is body of message xxx";

    mailServerProperties = System.getProperties();
    mailServerProperties.put("mail.smtp.port", "587");
    mailServerProperties.put("mail.smtp.auth", "true");
    mailServerProperties.put("mail.smtp.starttls.enable", "true");

    getMailSession = Session.getDefaultInstance(mailServerProperties, null);
    generateMailMessage = new MimeMessage(getMailSession);
    generateMailMessage.addRecipient(Message.RecipientType.CC, new InternetAddress(receiveremail@gmail.com));
    generateMailMessage.setSubject("This is subject xxx");

    generateMailMessage.setContent(emailBody, "text/html");
    Transport transport = getMailSession.getTransport("smtp");
    transport.connect("smtp.gmail.com", "my-email@gmail.com", "mypasswordxxx");
    transport.sendMessage(generateMailMessage, generateMailMessage.getAllRecipients());
    transport.close();
}

然后我想在我自己的邮件域(findtaxi.com)上使用Zimbra邮件服务。 我想使用我的电子邮件域(justin@findtaxi.com)发送电子邮件,它使用Zimbra服务。我遵循这个configuration,我改变了一些值:

 mailServerProperties.put("mail.smtp.port", "25");
 transport.connect("zimbra.findtaxi.com", "justin@findtaxi.com", "thispassword");

但无法发送消息。

javax.mail.MessagingException: Could not connect to SMTP host: zimbra.findtaxi.com, port: 25; nested exception is: 
java.net.ConnectException: Connection timed out: connect

是否可以在javamail上发送带有Zimbra的电子邮件?

0 个答案:

没有答案