ASF Bugzilla – Attachment 5892 Details for
Bug 19125
SMTP Appender should support more of the JavaMail configurations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add cc and priority options
SMTPAppender.head.patchfile (text/plain), 5.87 KB, created by
Jon Wilmoth
on 2003-04-18 17:53:40 UTC
(
hide
)
Description:
Patch to add cc and priority options
Filename:
MIME Type:
Creator:
Jon Wilmoth
Created:
2003-04-18 17:53:40 UTC
Size:
5.87 KB
patch
obsolete
>Index: src/java/org/apache/log4j/net/SMTPAppender.java >=================================================================== >RCS file: /home/cvspublic/jakarta-log4j/src/java/org/apache/log4j/net/SMTPAppender.java,v >retrieving revision 1.31 >diff -u -r1.31 SMTPAppender.java >--- src/java/org/apache/log4j/net/SMTPAppender.java 18 Mar 2003 13:33:32 -0000 1.31 >+++ src/java/org/apache/log4j/net/SMTPAppender.java 18 Apr 2003 17:24:16 -0000 >@@ -43,10 +43,38 @@ > @author Ceki Gülcü > @since 1.0 */ > public class SMTPAppender extends AppenderSkeleton { >+ /** >+ * Comma seperated list of email addresses for the To line. >+ */ > private String to; >+ /** >+ * Comma seperated list of email addresses for the Cc line. >+ */ >+ private String cc; >+ /** >+ * Email addresses for the From line (also becomes the reply-to). >+ */ > private String from; >+ /** >+ * Email subject line value. >+ */ > private String subject; >+ /** >+ * Email server to use to send messages. >+ */ > private String smtpHost; >+ >+ /** >+ * Email header used to set messages to higher or lower priority given a numerical value of 1 through 5. >+ * <ol> >+ * <li>Highest Priority</li> >+ * <li>High Priority</li> >+ * <li>Normal (default if not defined)</li> >+ * <li>Low Priority</li> >+ * <li>Lowest Priority</li> >+ * </ol> >+ */ >+ private int priority = 3; > private int bufferSize = 512; > private boolean locationInfo = false; > >@@ -92,15 +120,25 @@ > > try { > if (from != null) >- msg.setFrom(getAddress(from)); >+ msg.setFrom(getAddress(from)); > else >- msg.setFrom(); >+ msg.setFrom(); > > msg.setRecipients(Message.RecipientType.TO, parseAddress(to)); >+ >+ //Add CC receipients if defined. >+ if (cc != null && !"".equals(cc)) { >+ msg.setRecipients(Message.RecipientType.CC, parseAddress(cc)); >+ } >+ >+ //Set email priority >+ msg.addHeader("X-Priority", String.valueOf(getPriority())); >+ >+ //Add Subject if present > if(subject != null) >- msg.setSubject(subject); >+ msg.setSubject(subject); > } catch(MessagingException e) { >- LogLog.error("Could not activate SMTPAppender options.", e ); >+ LogLog.error("Could not activate SMTPAppender options.", e ); > } > } > >@@ -180,14 +218,6 @@ > } > } > >- /** >- Returns value of the <b>To</b> option. >- */ >- public >- String getTo() { >- return to; >- } >- > > /** > The <code>SMTPAppender</code> requires a {@link >@@ -242,7 +272,20 @@ > } > } > >- >+ /** >+ The <b>EvaluatorClass</b> option takes a string value >+ representing the name of the class implementing the {@link >+ TriggeringEventEvaluator} interface. A corresponding object will >+ be instantiated and assigned as the triggering event evaluator >+ for the SMTPAppender. >+ */ >+ public >+ void setEvaluatorClass(String value) { >+ evaluator = (TriggeringEventEvaluator) >+ OptionConverter.instantiateByClassName(value, >+ TriggeringEventEvaluator.class, >+ evaluator); >+ } > > /** > Returns value of the <b>EvaluatorClass</b> option. >@@ -253,11 +296,12 @@ > } > > /** >- Returns value of the <b>From</b> option. >+ The <b>Subject</b> option takes a string value which should be a >+ the subject of the e-mail message. > */ > public >- String getFrom() { >- return from; >+ void setSubject(String subject) { >+ this.subject = subject; > } > > /** >@@ -278,15 +322,13 @@ > } > > /** >- The <b>Subject</b> option takes a string value which should be a >- the subject of the e-mail message. >+ Returns value of the <b>From</b> option. > */ > public >- void setSubject(String subject) { >- this.subject = subject; >+ String getFrom() { >+ return from; > } > >- > /** > The <b>BufferSize</b> option takes a positive integer > representing the maximum number of logging events to collect in a >@@ -301,6 +343,14 @@ > } > > /** >+ Returns value of the <b>BufferSize</b> option. >+ */ >+ public >+ int getBufferSize() { >+ return bufferSize; >+ } >+ >+ /** > The <b>SMTPHost</b> option takes a string value which should be a > the host name of the SMTP server that will send the e-mail message. > */ >@@ -326,31 +376,47 @@ > this.to = to; > } > >+ /** >+ Returns value of the <b>To</b> option. >+ */ >+ public >+ String getTo() { >+ return to; >+ } > >+ /** >+ The <b>Cc</b> option takes a string value which should be a >+ comma separated list of e-mail address of the recipients. >+ */ >+ public >+ void setCc(String cc) { >+ this.cc = cc; >+ } > > /** >- Returns value of the <b>BufferSize</b> option. >+ Returns value of the <b>Cc</b> option. > */ > public >- int getBufferSize() { >- return bufferSize; >+ String getCc() { >+ return cc; > } > > /** >- The <b>EvaluatorClass</b> option takes a string value >- representing the name of the class implementing the {@link >- TriggeringEventEvaluator} interface. A corresponding object will >- be instantiated and assigned as the triggering event evaluator >- for the SMTPAppender. >+ The <b>Priority</b> option takes a positive integer (1 through 5) >+ representing the priority of the email message. Default is 3 (aka normal). > */ > public >- void setEvaluatorClass(String value) { >- evaluator = (TriggeringEventEvaluator) >- OptionConverter.instantiateByClassName(value, >- TriggeringEventEvaluator.class, >- evaluator); >+ void setPriority(int priority) { >+ this.priority = priority; > } > >+ /** >+ Returns value of the <b>Priority</b> option. >+ */ >+ public >+ int getPriority() { >+ return priority; >+ } > > /** > The <b>LocationInfo</b> option takes a boolean value. By
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19125
:
5892
|
16885