[opencms-dev] email question

Robert Petermeier robert2.0 at gmx.de
Tue Mar 15 18:46:09 CET 2005


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



More information about the opencms-dev mailing list