diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/notification/MailNotification.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/notification/MailNotification.java | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/pki/base/common/src/com/netscape/cms/notification/MailNotification.java b/pki/base/common/src/com/netscape/cms/notification/MailNotification.java index 1e409af8..21401eef 100644 --- a/pki/base/common/src/com/netscape/cms/notification/MailNotification.java +++ b/pki/base/common/src/com/netscape/cms/notification/MailNotification.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.notification; - import java.io.IOException; import java.io.PrintStream; import java.util.Vector; @@ -30,13 +29,11 @@ import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.notification.ENotificationException; import com.netscape.certsrv.notification.IMailNotification; - /** - * This class handles mail notification via SMTP. - * This class uses <b>smtp.host</b> in the configuration for smtp - * host. The port default (25) is used. If no smtp specified, local - * host is used - * + * This class handles mail notification via SMTP. This class uses + * <b>smtp.host</b> in the configuration for smtp host. The port default (25) is + * used. If no smtp specified, local host is used + * * @version $Revision$, $Date$ */ public class MailNotification implements IMailNotification { @@ -55,11 +52,9 @@ public class MailNotification implements IMailNotification { public MailNotification() { if (mHost == null) { try { - IConfigStore mConfig = - CMS.getConfigStore(); + IConfigStore mConfig = CMS.getConfigStore(); - IConfigStore c = - mConfig.getSubStore(PROP_SMTP_SUBSTORE); + IConfigStore c = mConfig.getSubStore(PROP_SMTP_SUBSTORE); if (c == null) { return; @@ -67,10 +62,10 @@ public class MailNotification implements IMailNotification { mHost = c.getString(PROP_HOST); // log it - // if (mHost !=null) { - // String msg =" using external SMTP host: "+mHost; - // CMS.debug("MailNotification: " + msg); - //} + // if (mHost !=null) { + // String msg =" using external SMTP host: "+mHost; + // CMS.debug("MailNotification: " + msg); + // } } catch (Exception e) { // don't care } @@ -94,7 +89,7 @@ public class MailNotification implements IMailNotification { if ((mFrom != null) && (!mFrom.equals(""))) sc.from(mFrom); else { - throw new ENotificationException ( + throw new ENotificationException( CMS.getUserMessage("CMS_NOTIFICATION_NO_SMTP_SENDER")); } @@ -103,7 +98,7 @@ public class MailNotification implements IMailNotification { log(ILogger.LL_INFO, "mail to be sent to " + mTo); sc.to(mTo); } else { - throw new ENotificationException ( + throw new ENotificationException( CMS.getUserMessage("CMS_NOTIFICATION_NO_SMTP_RECEIVER")); } @@ -128,14 +123,16 @@ public class MailNotification implements IMailNotification { try { sc.closeServer(); } catch (IOException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("OPERATION_ERROR", e.toString())); - throw new ENotificationException ( - CMS.getUserMessage("CMS_NOTIFICATION_SMTP_SEND_FAILED", mTo)); + log(ILogger.LL_FAILURE, + CMS.getLogMessage("OPERATION_ERROR", e.toString())); + throw new ENotificationException(CMS.getUserMessage( + "CMS_NOTIFICATION_SMTP_SEND_FAILED", mTo)); } } /** * sets the "From" field + * * @param from email address of the sender */ public void setFrom(String from) { @@ -144,6 +141,7 @@ public class MailNotification implements IMailNotification { /** * sets the "Subject" field + * * @param subject subject of the email */ public void setSubject(String subject) { @@ -152,6 +150,7 @@ public class MailNotification implements IMailNotification { /** * sets the "Content-Type" field + * * @param contentType content type of the email */ public void setContentType(String contentType) { @@ -160,6 +159,7 @@ public class MailNotification implements IMailNotification { /** * sets the content of the email + * * @param content the message content */ public void setContent(String content) { @@ -168,6 +168,7 @@ public class MailNotification implements IMailNotification { /** * sets the recipients' email addresses + * * @param addresses a list of email addresses of the recipients */ public void setTo(Vector addresses) { @@ -177,6 +178,7 @@ public class MailNotification implements IMailNotification { /** * sets the recipient's email address + * * @param to address of the recipient email address */ public void setTo(String to) { @@ -186,8 +188,8 @@ public class MailNotification implements IMailNotification { private void log(int level, String msg) { if (mLogger == null) return; - mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_OTHER, - level, "MailNotification: " + msg); + mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_OTHER, level, + "MailNotification: " + msg); } } |