Jump to content

Send Email wAuthentication Freezes on Port 465


gdurniak
 Share

This topic is 4414 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 2 weeks later...

Thanks. I wasted a *lot* of time on this, but did learn something

Scriptmaster is an amazing tool, if you have the patience to find the right code

I found the Groovy code for Gmail also works for Zimbra thru Scriptmaster, and appears to use SSL

greg

import javax.mail.*;

import javax.mail.internet.*;

Properties props = new Properties();

props.put("mail.transport.protocol", "smtps");

//props.setProperty("mail.smtp.host", smtpHost);

props.put("mail.smtps.host", smtpHost);

props.put("mail.smtps.auth", "true");

MimeMessage msg = new MimeMessage(Session.getInstance(props));

Multipart content = new MimeMultipart();

// first the message body

MimeBodyPart bodyPart = new MimeBodyPart();

bodyPart.setContent(htmlBody, "text/html");

content.addBodyPart(bodyPart);

// then the attachment

if (attachmentPath) {

MimeBodyPart attachmentPart = new MimeBodyPart();

attachmentPart.attachFile(attachmentPath);

content.addBodyPart(attachmentPart);

}

msg.setContent(content);

msg.setSubject(subject);

msg.setFrom(new InternetAddress(from));

msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));

//Transport transport = Session.getDefaultInstance(props).getTransport("smtp");

Session mailSession = Session.getDefaultInstance(props);

mailSession.setDebug(true);

Transport transport = mailSession.getTransport();

//int port = -1; // use the default port

//int port = 587; // use the alt port, e.g. AOL

int port = 465; // use the Zimbra port

//int port = 25;

transport.connect(smtpHost, port, username, password);

transport.sendMessage(msg, msg.getAllRecipients());

transport.close();

return true

>scriptmaster's built-in email module doesn't support SSL. You will need to use our Email plugin, which I think i responded to your question about already.

Link to comment
Share on other sites

This topic is 4414 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.