gdurniak Posted December 26, 2010 Posted December 26, 2010 I am trying to smtp thru Zimbra, which requires port 465, and SSL but when I edit the groovy code to use Port 465, it freezes ( beach ball ) It does work thru Outlook Express, so the account info is correct greg
Smef Posted January 4, 2011 Posted January 4, 2011 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.
gdurniak Posted January 7, 2011 Author Posted January 7, 2011 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now