[ https://issues.apache.org/jira/browse/OFBIZ-1256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532908 ]
Jacques Le Roux commented on OFBIZ-1256: ---------------------------------------- I would prefer a file than to have to copy a comment and create a file but at least this patch is near the good format (but I had also to indent + lines and the path begin in applications and not root) Eventually, I was not able to merge it : outdated... > Send mail through gmail with the javamail api in ofbiz > ------------------------------------------------------ > > Key: OFBIZ-1256 > URL: https://issues.apache.org/jira/browse/OFBIZ-1256 > Project: OFBiz > Issue Type: New Feature > Affects Versions: SVN trunk > Environment: All > Reporter: Fabien Carrion > Priority: Minor > Fix For: Release Branch 4.0 > > > This a small patch to accept ssl connections to smtp servers. > Index: content/src/org/ofbiz/content/email/EmailServices.java > =================================================================== > --- content/src/org/ofbiz/content/email/EmailServices.java (revision > 576503) > +++ content/src/org/ofbiz/content/email/EmailServices.java (working copy) > @@ -129,6 +129,8 @@ > > String sendFrom = (String) context.get("sendFrom"); > String sendType = (String) context.get("sendType"); > + String port = (String) context.get("port"); > + String ssl = (String) context.get("ssl"); > String sendVia = (String) context.get("sendVia"); > String authUser = (String) context.get("authUser"); > String authPass = (String) context.get("authPass"); > @@ -151,6 +153,12 @@ > if (authUser != null && authUser.length() > 0) { > useSmtpAuth = true; > } > + if (port == null || port.length() == 0) { > + port = UtilProperties.getPropertyValue("general.properties", > "mail.smtp.port", "25"); > + } > + if (ssl == null || ssl.length() == 0) { > + ssl = UtilProperties.getPropertyValue("general.properties", > "mail.smtp.ssl", "javax.net.ssl.SSLSocketFactory"); > + } > } else if (sendVia == null) { > return ServiceUtil.returnError("Parameter sendVia is required > when sendType is not mail.smtp.host"); > } > @@ -168,6 +176,14 @@ > try { > Properties props = System.getProperties(); > props.put(sendType, sendVia); > + if (port != null && port.length() > 0) { > + props.put("mail.smtp.port", port); > + props.put("mail.smtp.socketFactory.port", port); > + } > + if (ssl != null && ssl.length() > 0) { > + props.put("mail.smtp.socketFactory.class", ssl); > + props.put("mail.smtp.socketFactory.fallback", "false"); > + } > if (useSmtpAuth) { > props.put("mail.smtp.auth", "true"); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.