On Wed, Mar 28, 2012 at 1:58 PM, Alan Cole <[email protected]> wrote:

> How would I test the use of "JavaMail"?
>

Just replace "your.mail.server" and the email addresses in the example
below.

<cfscript language="java" jarlist="mail.jar">
        import java.util.*;
        import javax.mail.*;
        import javax.mail.internet.*;

        Properties props = new Properties(); // Properties props =
System.getProperties();
        props.put("mail.smtp.host", "your.mail.server");

        Session session = Session.getDefaultInstance(props, null);

        Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress("[email protected]"));
        msg.addRecipient(Message.RecipientType.TO, new InternetAddress("
[email protected]"));
        msg.setSubject("Test from JavaMail");
        msg.setContent("This is the message body", "text/plain");

        Transport.send(msg);
</cfscript>
-- 
Matthew Woodward
[email protected]
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html

-- 
online documentation: http://openbd.org/manual/
   google+ hints/tips: https://plus.google.com/115990347459711259462
     http://groups.google.com/group/openbd?hl=en

Reply via email to