[opencms-dev] email question

Stephan Hartmann beffe at beffe.de
Wed Mar 16 16:24:14 CET 2005


Re: [opencms-dev] email questionYou have to catch a javax.mail.MessagingException.

Regards
  ----- Original Message ----- 
  From: Alexis Torreno 
  To: The OpenCms mailing list 
  Sent: Wednesday, March 16, 2005 4:15 PM
  Subject: Re: [opencms-dev] email question


  Hello Robert,

  Thanks for the response. I wasn't very clear about my syntax error, allow me to clarify:

  I have this snippet:

  try{
   email.send();
  } catch (EmailException e)
   [code goes in here]
  }

  Now, when I run my JSP, I get a compile-time error, because java doesn't like EmailException (i.e. cannot resolve symbol).

  Okay, should be easy to fix, maybe I just forgot to import something? I am already importing org.opencms.mail.* and org.apache.commons.mail.*.

  Am I missing an import? Do I need an extra jar file in my /lib folder? I'm sure it's something small

  Al


  Alexis Torreno 
  Web Developer

  TAYLOR|SPRULES CORPORATION
  Head Office
  66 The Esplanade
  Toronto, ON M5E 1A6

  Voice 416.362.4833 X 246
  Fax 416.362.5824
  alexis at tsworld.com
  www.tsworld.com

  TAYLOR|SPRULES CORPORATION 
  We develop and implement great ideas for
  intelligent corporations, individuals, governments 
  and NGO's around the world.

  TAYLOR|SPRULES CORPORATION
  Nous développons et lançons de grandes idées 
  pour des corporations, des particuliers, des gouvernements 
  et des ONGs intelligents à travers le monde. 


    From: Robert Petermeier <robert2.0 at gmx.de>
    Reply-To: The OpenCms mailing list <opencms-dev at opencms.org>
    Date: Tue, 15 Mar 2005 18:46:09 +0100
    To: The OpenCms mailing list <opencms-dev at opencms.org>
    Subject: Re: [opencms-dev] email question




    Alexis Torreno schrieb:
    > I want to be able to catch an exception when using CmsSimpleMail, if the
    > email cannot be sent.
    > 
    > Has anyone done this?

    Yes.

    > I tried using EmailException, from org.apache.commons.mail, but I get a
    > syntax error when trying to run my JSP.

    But you don't wanna tell which error that is or post some code?

    > 
    > I'm new to exceptions, and try/catch, any help is appreciated.

    Well, using commons email is pretty straightforward, so I suggest you read
    <http://java.sun.com/docs/books/tutorial/java/nutsandbolts/exception.html>

    The only "pitfall" I can think of with commons email is that the
    addTo(), addCc() and addBcc() methods take String objects as arguments
    while the setTo(), setCc() and setBcc() methods take as argument a
    Collection of not Strings but InternetAddress objects. And you need to
    specify the email server in IIRC opencms-system.xml.


    Regards,
    Robert


    _______________________________________________
    This mail is send to you from the opencms-dev mailing list
    To change your list options, or to unsubscribe from the list, please visit
    http://mail.opencms.org/mailman/listinfo/opencms-dev







------------------------------------------------------------------------------




  _______________________________________________
  This mail is send to you from the opencms-dev mailing list
  To change your list options, or to unsubscribe from the list, please visit
  http://mail.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050316/169b3012/attachment.htm>


More information about the opencms-dev mailing list