Why I cannot use Gmail configuration for Zimbra mail?

665 views Asked by At

I have gmail configuration script for send email using Gmail mail service, and these codes can send email Correctly:

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([email protected]));
    generateMailMessage.setSubject("This is subject xxx");

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

Then I want to use Zimbra mail service with my own mail domain (findtaxi.com). I want send email using my email domain ([email protected]), it use Zimbra service. I follow this configuration, I change some values :

 mailServerProperties.put("mail.smtp.port", "25");
 transport.connect("zimbra.findtaxi.com", "[email protected]", "thispassword");

But cannot send the message.

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

Is it possible to send email with Zimbra on javamail?

0

There are 0 answers