View Javadoc
1 /* 2 * PROJECT : emailEJB 3 * 4 * COPYRIGHT : Copyright (C) 1999-2003 Tim Stephenson 5 * 6 * contact me at gpl@enableit.org. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 package org.enableit.tools.email.ejb; 23 24 // Java Imports 25 import java.io.File ; 26 import java.io.IOException ; 27 import java.net.URL ; 28 import java.util.Date; 29 import java.util.Iterator; 30 import java.util.Properties; 31 32 import javax.activation.DataHandler; 33 import javax.activation.FileDataSource ; 34 import javax.activation.URLDataSource ; 35 import javax.naming.Context; 36 import javax.naming.InitialContext; 37 import javax.naming.NamingException; 38 39 import javax.mail.BodyPart; 40 import javax.mail.Message; 41 import javax.mail.MessagingException; 42 import javax.mail.Part; 43 import javax.mail.Session; 44 import javax.mail.Transport; 45 import javax.mail.internet.AddressException; 46 import javax.mail.internet.InternetAddress; 47 import javax.mail.internet.MimeBodyPart; 48 import javax.mail.internet.MimeMessage; 49 import javax.mail.internet.MimeMultipart; 50 51 // required for SSL URL connections 52 import java.security.Security ; 53 54 // HTTP Client imports 55 import org.apache.commons.httpclient.HttpClient ; 56 import org.apache.commons.httpclient.methods.GetMethod ; 57 58 // Log4J Imports 59 import org.apache.log4j.Logger; 60 61 import org.enableit.tools.email.interfaces.Attachment ; 62 import org.enableit.tools.email.interfaces.EmailConfigBean ; 63 64 /*** 65 * An EJB for sending email. 66 * 67 * @see <a href="http://darrt.sourceforge.net/emailEJB/index.html"> 68 * Main documentation</a> 69 * @author Tim Stephenson 70 * 71 * @ejb:bean type="Stateless" name="Email" jndi-name="Email" 72 * display-name="Email" 73 * @ejb:transaction type="Supports" 74 * @ejb:transaction-type type="Container" 75 * @ejb:util generate="physical" 76 * @ejb:env-entry name="HOST" type="java.lang.String" value="mail.mydomain.com" 77 * @ejb:env-entry name="MBOX" type="java.lang.String" value="null" 78 * @ejb:env-entry name="PROTOCOL" type="java.lang.String" value="SMTP" 79 * @ejb:env-entry name="USER" type="java.lang.String" value="username" 80 * @ejb:env-entry name="PASSWD" type="java.lang.String" value="password" 81 * @ejb:env-entry name="SEND" type="java.lang.String" value="send" 82 * @ejb:env-entry name="MAILER" type="java.lang.String" value="msgsend" 83 * @ejb:env-entry name="FROM" type="java.lang.String" 84 * value="username@mydomain.com" 85 * @ejb:env-entry name="DEBUG" type="java.lang.Boolean" value="Boolean.TRUE" 86 */ 87 public class EmailBean extends Object { 88 89 // Constructors -------------------------------------------------------------- 90 91 /*** 92 * Default constructor. 93 * This is the only constructor allowable for an EJB 94 */ 95 public EmailBean() { 96 97 } 98 99 // Lifecycle Methods --------------------------------------------------------- 100 101 /*** 102 * Called by container when creating new bean instance. 103 * @see <a href="http://java.sun.com/products/ejb/">EJB spec</a> 104 */ 105 public void ejbCreate() 106 throws javax.ejb.CreateException, javax.ejb.EJBException { 107 initialise() ; 108 } 109 110 // Business Methods ---------------------------------------------------------- 111 112 /*** 113 * Initialise the bean configurations from JNDI tree. 114 */ 115 protected void initialise() { 116 // Log the entry into the method. 117 logger.info("METHOD_ENTRY initialise"); 118 119 if (!initialised) { 120 // Lookup the environment vars (these are mandatory) 121 Context myEnv = null ; 122 try { 123 Security.addProvider( 124 new com.sun.net.ssl.internal.ssl.Provider()); 125 // TODO: Allow to be overridden by JNDI environment property 126 System.setProperty("java.protocol.handler.pkgs", 127 "com.sun.net.ssl.internal.www.protocol") ; 128 129 Context ic = new InitialContext(); 130 myEnv = (Context) ic.lookup("java:comp/env"); 131 // Get the mail server config 132 protocol = (String) myEnv.lookup("PROTOCOL"); 133 logger.warn("Email:protocol:" + protocol) ; 134 mbox = (String) myEnv.lookup("MBOX"); 135 logger.warn("Email:mbox:" + mbox) ; 136 send = (String) myEnv.lookup("SEND"); 137 logger.warn("Email:send:" + send) ; 138 host = (String) myEnv.lookup("HOST"); 139 logger.warn("Email:host:" + host) ; 140 user = (String) myEnv.lookup("USER"); 141 logger.warn("Email:user:" + user) ; 142 passwd = (String) myEnv.lookup("PASSWD"); 143 logger.warn("Email:passwd:" + passwd) ; 144 mailer = (String) myEnv.lookup("MAILER"); 145 logger.warn("Email:mailer:" + mailer) ; 146 from = (String) myEnv.lookup("FROM"); 147 logger.warn("Email:from:" + from) ; 148 } catch (NamingException ne) { 149 logger.error(ne.getMessage()) ; 150 } 151 152 try { 153 debug = (Boolean) myEnv.lookup("DEBUG"); 154 logger.warn("Email:debug:" + debug.toString()) ; 155 } catch (NamingException ne) { 156 logger.warn("No env var 'DEBUG' found, " 157 + " mail debugging will be switched off.") ; 158 } 159 try { 160 String tmpBlankSubject = (String) 161 myEnv.lookup("BLANK_SUBJECT"); 162 if (tmpBlankSubject != null && tmpBlankSubject.length() > 0) { 163 blankSubject = tmpBlankSubject ; 164 } 165 logger.warn("Email:blankSubject:" + blankSubject) ; 166 } catch (NamingException ne) { 167 logger.warn("No env var 'BLANK_SUBJECT' found.") ; 168 } 169 170 initialised = true ; 171 } 172 173 // Log the exit from the method. 174 logger.info("METHOD_EXIT initialise"); 175 } 176 177 /*** 178 * Initialise the bean configurations from params. 179 * 180 * <p>This method is really only intended for testing purposes, 181 * though it could also be used to initialise this class as a 182 * simple class, rather than an EJB.</p> 183 * @param protocol The mail protocol to configure with. 184 * @param mbox Not used since no mailbox is ever read. 185 * @param send JavaMail property 'send' 186 * @param host The outgoing mail host. 187 * @param user User to authenticate with on the outgoing mail server. 188 * @param passwd Password (plain text) to authenticate with on the 189 * outgoing mail server. 190 * @param mailer JavaMail property 'mailer' 191 * @param from Default for the mail 'from' field if not provided on send. 192 * @param debug Whether to use a debug mail session. 193 * @param blankSubject The subject to use when the caller of sendEmail 194 * does not provide one (may be blank but may <em>not</em> be null). 195 */ 196 protected void initialise(String protocol, String mbox, String send, 197 String host, String user, String passwd, String mailer, 198 String from, Boolean debug, String blankSubject) { 199 // Log the entry into the method. 200 logger.info("METHOD_ENTRY initialise"); 201 202 if (!initialised) { 203 Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); 204 // TODO: Allow to be overridden by JNDI environment property 205 System.setProperty("java.protocol.handler.pkgs", 206 "com.sun.net.ssl.internal.www.protocol") ; 207 208 // Get the mail server config 209 this.protocol = protocol; 210 logger.warn("Email:protocol:" + protocol) ; 211 this.mbox = mbox; 212 logger.warn("Email:mbox:" + mbox) ; 213 this.send = send; 214 logger.warn("Email:send:" + send) ; 215 this.host = host; 216 logger.warn("Email:host:" + host) ; 217 this.user = user; 218 logger.warn("Email:user:" + user) ; 219 this.passwd = passwd; 220 logger.warn("Email:passwd:" + passwd) ; 221 this.mailer = mailer; 222 logger.warn("Email:mailer:" + mailer) ; 223 this.from = from; 224 logger.warn("Email:from:" + from) ; 225 226 this.debug = debug; 227 logger.warn("Email:debug:" + debug.toString()) ; 228 229 String tmpBlankSubject = blankSubject; 230 if (tmpBlankSubject != null && tmpBlankSubject.length() > 0) { 231 this.blankSubject = tmpBlankSubject ; 232 } 233 logger.warn("Email:blankSubject:" + blankSubject) ; 234 235 initialised = true ; 236 } 237 238 // Log the exit from the method. 239 logger.info("METHOD_EXIT initialise"); 240 } 241 242 /*** 243 * Sends an email message using the Mail server configured in the JNDI 244 * environment. 245 * 246 * @param to Target email address. 247 * @param from Message 'from' address. If supplied this overrides the 248 * default in the JNDI context. 249 * @param subject Subject for the mail message. 250 * @param message Body text for the mail message. 251 * @throws java.rmi.RemoteException System exception, notably 252 * misconfiguration of mail server. 253 * 254 * @ejb:interface-method view-type="remote" 255 */ 256 public void sendEmail(String to, String from, 257 String subject, String message) 258 throws java.rmi.RemoteException { 259 logger.info("METHOD_ENTRY sendEmail"); 260 261 EmailConfigBean bean = 262 new EmailConfigBean(to, from, subject, message) ; 263 264 this.sendEmail(bean) ; 265 266 logger.info("METHOD_EXIT sendEmail"); 267 } 268 269 /*** 270 * Sends an email message using the Mail server configured in the JNDI 271 * environment and creates an attachment too. 272 * 273 * @param to Target email address. 274 * @param from Message 'from' address. If supplied this overrides the 275 * default in the JNDI context. 276 * @param subject Subject for the mail message. 277 * @param message Body text for the mail message. 278 * @param attachmentText Text to create as a text/plain attachment. 279 * @throws java.rmi.RemoteException System exception, notably 280 * misconfiguration of mail server. 281 * 282 * @ejb:interface-method view-type="remote" 283 */ 284 public void sendEmail(String to, String from, 285 String subject, String message, String attachmentText) 286 throws java.rmi.RemoteException { 287 logger.info("METHOD_ENTRY sendEmail"); 288 289 EmailConfigBean bean = 290 new EmailConfigBean(to, from, subject, message) ; 291 Attachment attachment = null ; 292 if ((attachmentText.indexOf("<html>") != -1) 293 || (attachmentText.indexOf("<HTML>") != -1)) { 294 attachment = new Attachment(attachmentText, MT_HTML, 295 "attachment.html") ; 296 } else { 297 attachment = new Attachment(attachmentText, MT_PLAIN_TEXT, 298 "attachment.txt") ; 299 } 300 bean.addAttachment(attachment) ; 301 302 this.sendEmail(bean) ; 303 304 logger.info("METHOD_EXIT sendEmail"); 305 } 306 307 /*** 308 * Sends an email made up of a message and an attachment. 309 * 310 * Converts a URL reference to an InputStream. 311 * The URL must be accessible using the http(s) protocol. 312 * 313 * @param to Target email address. 314 * @param from Message 'from' address. If supplied this overrides the 315 * default in the JNDI context. 316 * @param subject Subject for the mail message. 317 * @param message Body text for the mail message. 318 * @param attachmentUrl URL to fetch and create as an attachment. 319 * @throws java.rmi.RemoteException System exception, notably 320 * misconfiguration of mail server. 321 * 322 * @ejb:interface-method view-type="remote" 323 */ 324 public void sendEmail(String to, String from, 325 String subject, String message, URL attachmentUrl) 326 throws java.rmi.RemoteException { 327 logger.info("METHOD_ENTRY sendEmail, url=" 328 + attachmentUrl.toExternalForm()); 329 330 try { 331 EmailConfigBean bean = 332 new EmailConfigBean(to, from, subject, message) ; 333 Attachment attachment = new Attachment(attachmentUrl) ; 334 bean.addAttachment(attachment) ; 335 336 this.sendEmail(bean) ; 337 338 } catch (java.io.IOException e) { 339 logger.error("MessagingException: " + e.getMessage(), e) ; 340 throw new java.rmi.RemoteException(e.toString()) ; 341 } 342 343 logger.info("METHOD_EXIT sendEmail"); 344 } 345 346 /*** 347 * Sends an email made up of a message and an attachment. 348 * 349 * Converts a URL reference to an InputStream. 350 * The URL must be accessible using the http(s) protocol. 351 * 352 * @param bean An <code>EmailConfigBean</code> containing all the details 353 * for the message. 354 * @throws java.rmi.RemoteException System exception, notably 355 * misconfiguration of mail server. 356 * 357 * @ejb:interface-method view-type="remote" 358 */ 359 public void sendEmail(EmailConfigBean bean) 360 throws java.rmi.RemoteException { 361 logger.info("METHOD_ENTRY sendEmail(EmailConfigBean)"); 362 363 // Get the basic message 364 Message msg = getBaseMessage(bean.getTo(), bean.getFrom(), 365 bean.getSubject(), bean.getMessage()); 366 367 // Construct holder for the message 368 MimeMultipart holder = new MimeMultipart(); 369 // Construct the main body of message 370 BodyPart body = new MimeBodyPart() ; 371 372 try { 373 // sort the body 374 body.setDisposition(Part.INLINE); 375 body.setContent(bean.getMessage(), MT_PLAIN_TEXT) ; 376 holder.addBodyPart(body); 377 378 // sort the attachment(s) 379 try { 380 for (Iterator i = bean.getAttachmentList().iterator() ; 381 i.hasNext() ;) { 382 BodyPart attachment = new MimeBodyPart() ; 383 attachment.setDisposition(Part.ATTACHMENT); 384 385 Attachment attachmentBean = (Attachment) i.next() ; 386 String mimeType = attachmentBean.getMimeType() ; 387 Object data = null ; 388 389 /*if (attachmentBean.getAttachment() instanceof URL) { 390 logger.debug("Attachment is a URL.") ; 391 URL attachmentUrl = (URL) 392 attachmentBean.getAttachment() ; 393 394 // Construct a client to make the request 395 HttpClient client = new HttpClient() ; 396 client.startSession(attachmentUrl) ; 397 398 // make the request and get the response 399 int queryIdx = attachmentUrl.getFile().indexOf("?") ; 400 GetMethod get = null ; 401 if (queryIdx < 0) { 402 get = new GetMethod(attachmentUrl.getFile() 403 .substring(0, queryIdx)) ; 404 } else { 405 get = new GetMethod(attachmentUrl.getFile()) ; 406 } 407 logger.debug("Get method path=" + get.getPath()); 408 if (queryIdx > 0) { 409 get.setQueryString(attachmentUrl.getFile() 410 .substring(attachmentUrl.getFile() 411 .indexOf("?") + 1)) ; 412 } 413 get.setStrictMode(false) ; // TODO: parameterise 414 // already done in GetMethod 415 get.setFollowRedirects(true) ; 416 int httpCode = client.executeMethod(get) ; 417 logger.info("Response code was: " + httpCode); 418 419 data = get.getResponseBodyAsString() ; 420 logger.debug("Response was: " + data); 421 */ 422 /* 423 * Some headers may be multi-valued, 424 * but content type is not one of them 425 */ 426 /* Header contentType = 427 get.getResponseHeader("Content-Type") ; 428 if (contentType != null 429 && contentType.getValues() != null) { 430 logger.info("Response content header: " 431 + contentType.getValues()[0].toString()); 432 mimeType = contentType.getValues()[0].toString() ; 433 } else { 434 logger.error("URL response did not " 435 + " include content type") ; 436 // TODO: Often get no content type header 437 } 438 } else { 439 logger.debug("Attachment is a:" + attachmentBean 440 .getAttachment().getClass().getName()) ; 441 data = (String) attachmentBean.getAttachment(); 442 } 443 */ 444 Object obj = attachmentBean.getAttachment() ; 445 if (obj instanceof URL) { 446 logger.debug("Attachment is URL") ; 447 URLDataSource ds = new URLDataSource((URL) obj); 448 DataHandler dh = new DataHandler(ds) ; 449 data = dh.getContent() ; 450 mimeType = dh.getContentType() ; 451 String fileName = ((URL) obj).getFile() ; 452 if (fileName.startsWith("/")) { 453 fileName = fileName.substring(1) ; 454 } 455 attachment.setFileName(fileName) ; 456 attachment.setDataHandler(dh); 457 attachment.setDescription(fileName); 458 String type = dh.getContentType(); 459 logger.debug("detected content type: " + type) ; 460 if (type.startsWith("text")) { 461 logger.debug("attaching as attachment") ; 462 attachment.setDisposition(Part.ATTACHMENT); 463 } else { 464 logger.debug("attaching inline") ; 465 attachment.setDisposition(Part.INLINE); 466 } 467 468 attachment.setHeader("Content-Type", type); 469 } else if (obj instanceof File) { 470 logger.debug("Attachment is File") ; 471 File file = (File) obj ; 472 FileDataSource ds = new FileDataSource(file); 473 DataHandler dh = new DataHandler(ds) ; 474 data = dh.getContent() ; 475 mimeType = dh.getContentType() ; 476 attachment.setDescription(file.getName()); 477 attachment.setFileName(file.getName()) ; 478 attachment.setDataHandler(dh); 479 String type = dh.getContentType(); 480 logger.debug("detected content type: " + type) ; 481 if (type.startsWith("text")) { 482 logger.debug("attaching as attchment") ; 483 attachment.setDisposition(Part.ATTACHMENT); 484 } else { 485 logger.debug("attaching inline") ; 486 attachment.setDisposition(Part.INLINE); 487 } 488 489 attachment.setHeader("Content-Type", type); 490 } else if (obj instanceof String) { 491 logger.debug("Attachment is String") ; 492 data = obj ; 493 mimeType = MT_PLAIN_TEXT ; 494 } else if (obj instanceof Object) { 495 logger.debug("Attachment is Object") ; 496 DataHandler dh = new DataHandler(obj, MT_BINARY) ; 497 data = dh.getContent() ; 498 attachment.setFileName(attachmentBean.getName()) ; 499 attachment.setDataHandler(dh); 500 attachment.setDescription(attachmentBean.getName()); 501 logger.debug("attaching inline") ; 502 attachment.setDisposition(Part.INLINE); 503 mimeType = MT_BINARY ; 504 attachment.setHeader("Content-Type", mimeType); 505 } else { 506 data = "Unsupported attachment type: " 507 + obj.getClass().getName() ; 508 mimeType = MT_PLAIN_TEXT ; 509 logger.error("Unsupported attachment" 510 + obj.getClass().getName()) ; 511 } 512 attachment.setContent(data, mimeType) ; 513 holder.addBodyPart(attachment); 514 // TODO Having this here means it is done repeatedly, 515 // should do no harm <shrug> 516 holder.setSubType("mixed"); 517 } 518 } catch (org.apache.commons.httpclient.HttpException e) { 519 logger.error("Error handling request: " + e.getMessage()); 520 } catch (IOException ioe) { 521 logger.error(ioe.toString()); 522 } 523 524 // add to base message and send 525 msg.setContent(holder); 526 Transport.send(msg); 527 528 } catch (MessagingException e) { 529 logger.error("MessagingException: " + e.getMessage(), e) ; 530 } 531 532 logger.info("METHOD_EXIT sendEmail"); 533 } 534 535 /*** 536 * Constructs a <code>Multipart</code> containing the essential basic info 537 * 538 * @param to Target email address. 539 * @param from Message 'from' address. If supplied this overrides the 540 * default in the JNDI context. 541 * @param subject Subject for the mail message. 542 * @param message Body text for the mail message. 543 * @return Message. 544 */ 545 private Message getBaseMessage (String to, String from, 546 String subject, String message) { 547 logger.info("METHOD_ENTRY getBaseMessage"); 548 549 if (from == null) { 550 from = this.from ; 551 } 552 553 //URLName url = new URLName(protocol, host, -1, mbox, user, passwd); 554 Properties props = new Properties(); 555 // XXX - could use Session.getTransport() and Transport.connect() 556 // XXX - assume we're using SMTP 557 //props.put("mail.host", host); 558 props.put("mail.user", user); 559 props.put("mail.smtp.host", host); 560 561 // Get a Session object 562 session = Session.getDefaultInstance(props, null); 563 if (session == null) { 564 logger.error("Mail session instantiation failed with properties:"); 565 logger.error("props=" + props.toString()) ; 566 } else { 567 logger.info("Mail session instantiation succeeded"); 568 logger.info("props=" + props.toString()) ; 569 } 570 session.setDebug(debug.booleanValue()); 571 572 // Construct the message 573 Message msg = new MimeMessage(session); 574 try { 575 msg.setFrom(new InternetAddress(from)); 576 msg.setRecipients(Message.RecipientType.TO, 577 InternetAddress.parse(to, false)); 578 // msg.setRecipients(Message.RecipientType.CC, 579 // InternetAddress.parse(cc, false)); 580 // msg.setRecipients(Message.RecipientType.BCC, 581 // InternetAddress.parse(bcc, false)); 582 msg.setSubject(subject == null ? blankSubject : subject); 583 msg.setContent(blankMessage == null ? blankMessage : message, 584 MT_PLAIN_TEXT); 585 msg.setSentDate(new Date()); 586 msg.setHeader("X-Mailer", mailer); 587 } catch (AddressException ae) { 588 logger.error("AddressException: " + ae.getMessage()) ; 589 logger.error(ae) ; 590 } catch (MessagingException me) { 591 logger.error("MessagingException: " + me.getMessage()) ; 592 logger.error(me) ; 593 } 594 595 logger.info("METHOD_EXIT getBaseMessage"); 596 return msg ; 597 } 598 599 /*** 600 * Converts a URL reference to an InputStream 601 * 602 * <p>The URL must be accessable using the http protocol. </p> 603 * 604 * <p>Makes use of the commons-httpclient library 605 * <a href="http://jakarta.apache.org/commons/httpclient"> 606 * commons-httpclient library homepage</a>.</p> 607 * 608 * <p>This method is not used as the URL datasource in the activation 609 * library seems to do an adequate job. It has not yet been tested on 610 * https URLs; if it works there too this will be removed.</p> 611 * 612 * @param url The URL to fetch 613 * @return The content of the URL. 614 */ 615 private Object getUrlContent(URL url) { 616 logger.info("METHOD_ENTRY getUrlContent, url=" + url.toExternalForm()); 617 618 String data = new String(); 619 try { 620 // Construct a client to make the request 621 HttpClient client = new HttpClient() ; 622 client.startSession(url) ; 623 624 // make the request and get the response 625 GetMethod get = new GetMethod(url.toExternalForm()) ; 626 int httpCode = client.executeMethod(get) ; 627 628 switch (httpCode) { 629 case 100: 630 /* 631 * According to the W3C this is ok, 632 * response will be received in due course: 633 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.1 634 */ 635 logger.debug("Received HTTP code 100"); 636 break ; 637 638 case 200: 639 logger.debug("Received HTTP code 200"); 640 break ; 641 default : 642 logger.error("HTTP code was " + httpCode) ; 643 } 644 645 646 data = get.getResponseBodyAsString() ; 647 logger.debug("Response was: " + data); 648 649 } catch (org.apache.commons.httpclient.HttpException e) { 650 logger.error("Error handling request: " + e.getMessage()); 651 } catch (IOException ioe) { 652 logger.error(ioe.toString()); 653 } 654 655 logger.info("METHOD_EXIT: getUrlContent"); 656 return data ; 657 } 658 659 // Members ------------------------------------------------------------------- 660 661 /*** 662 * The Log4J <code>Logger</code> doing the logging. 663 */ 664 private static Logger logger = Logger.getLogger(EmailBean.class); 665 666 /*** The Mail protocol */ 667 private String protocol ; 668 669 /*** Mailbox to read from (not used) */ 670 private String mbox ; 671 672 /*** JavaMail property 'send' */ 673 private String send ; 674 675 /*** The Mail host */ 676 private String host ; 677 678 /*** The mail user to authenticate as */ 679 private String user ; 680 681 /*** Password for the Mail user */ 682 private String passwd ; 683 684 /*** JavaMail property 'mailer' */ 685 private String mailer ; 686 687 /*** Default 'from' address, if not supplied by caller */ 688 private String from ; 689 690 /*** Whether to log debug messages from the Mail session */ 691 private Boolean debug = Boolean.TRUE ; 692 693 /*** 694 * String to use when caller does not specify a Subject. 695 */ 696 private String blankSubject = "[No Subject]" ; 697 698 /*** 699 * String to use when caller does not specify a Message text. 700 */ 701 private String blankMessage = "[No Message]" ; 702 703 /*** 704 * Whether bean has already been initialised. 705 */ 706 private boolean initialised = false ; 707 708 /*** 709 * 710 */ 711 private Session session ; 712 713 // Constant member properties ------------------------------------------------- 714 715 /*** A valid message content type */ 716 public static final String MT_PLAIN_TEXT = "text/plain"; 717 718 /*** A valid message content type */ 719 public static final String MT_HTML = "text/html"; 720 721 /*** A valid message content type */ 722 public static final String MT_BINARY = "application/octet-stream" ; 723 724 /*** CVS info about this class and its current version */ 725 public static final String ABOUT = 726 "$Id: EmailBean.java,v 1.11 2003/01/27 07:27:24 TimAndVicky Exp $ $Revision: 1.11 $" ; 727 728 }

This page was automatically generated by Maven