使用Quartz SendMailJob的示例

时间:2012-09-20 16:50:56

标签: java javamail quartz-scheduler

我正在寻找使用Quartz调度程序中的SendMailJob类的帮助。我一直无法找到任何有用的文档,也无法找到实现它的“正确”方式,以便从Web应用程序按需发送批量邮件(这样该过程不依赖于servlet继续存在于电子邮件作业的整个生命周期中)

1 个答案:

答案 0 :(得分:-1)

此类提供了发送邮件的基本选项。你应该更好地重写你自己的类,它将与你的应用程序更加集成。 SendMailJob似乎与生产类一样存在......

无论如何,如果要使用它,必须在JobData映射中填充以下参数才能发送邮件。如果您需要更多详细信息,请查看此类的源代码。

/**
 * The host name of the smtp server. REQUIRED.
 */
public static final String PROP_SMTP_HOST = "smtp_host";

/**
 * The e-mail address to send the mail to. REQUIRED.
 */
public static final String PROP_RECIPIENT = "recipient";

/**
 * The e-mail address to cc the mail to. Optional.
 */
public static final String PROP_CC_RECIPIENT = "cc_recipient";

/**
 * The e-mail address to claim the mail is from. REQUIRED.
 */
public static final String PROP_SENDER = "sender";

/**
 * The e-mail address the message should say to reply to. Optional.
 */
public static final String PROP_REPLY_TO = "reply_to";

/**
 * The subject to place on the e-mail. REQUIRED.
 */
public static final String PROP_SUBJECT = "subject";

/**
 * The e-mail message body. REQUIRED.
 */
public static final String PROP_MESSAGE = "message";

/**
 * The message content type. For example, "text/html". Optional.
 */
public static final String PROP_CONTENT_TYPE = "content_type";