Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think sfussenegger has the right idea. But instead of using a custom authenticator, what about authenticating via connect(..)? Only tested with gmail. But it seems to work. </p> <p><strong>EDIT:</strong> I tested this with CF9 &amp; OBD successfully. Unfortunately, I had no luck with Railo ... bummer.</p> <p><strong>EDIT:</strong> Updated to add the missing "mail.smtp.auth" property. It should now work correctly with Railo as well.</p> <pre><code> //Java Version int port = 587; String host = "smtp.gmail.com"; String user = "username@gmail.com"; String pwd = "email password"; try { Properties props = new Properties(); // required for gmail props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.auth", "true"); // or use getDefaultInstance instance if desired... Session session = Session.getInstance(props, null); Transport transport = session.getTransport("smtp"); transport.connect(host, port, user, pwd); transport.close(); System.out.println("success"); } catch(AuthenticationFailedException e) { System.out.println("AuthenticationFailedException - for authentication failures"); e.printStackTrace(); } catch(MessagingException e) { System.out.println("for other failures"); e.printStackTrace(); } &lt;cfscript&gt; //CF Version port = 587; host = "smtp.gmail.com"; user = "username@gmail.com"; pwd = "email password"; try { props = createObject("java", "java.util.Properties").init(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.auth", "true"); // or use getDefaultInstance instance if desired... mailSession = createObject("java", "javax.mail.Session").getInstance(props, javacast("null", "")); transport = mailSession.getTransport("smtp"); transport.connect(host, port, user, pwd); transport.close(); WriteOutput("success"); } //for authentication failures catch(javax.mail.AuthenticationFailedException e) { WriteOutput("Error: "&amp; e.type &amp;" ** "&amp; e.message); } // for other failures catch(javax.mail.MessagingException e) { WriteOutput("Error: "&amp; e.type &amp;" ** "&amp; e.message); } &lt;/cfscript&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload