1 package jp.co.areaweb.tools.mail;
\r
3 import hayashi.yuu.tools.properties.Properties;
\r
4 import java.io.FileInputStream;
\r
7 * メールアカウント設定情報を保持するインスタンス
\r
9 * @version 2010/02/05 項目'MAIL_SMTP_PORT'を追加
\r
11 public class SiteData {
\r
12 public String MAIL_SMTP = "192.168.0.10";
\r
13 public String MAIL_SMTP_PORT = "25";
\r
14 public String MAIL_FROM = "webserver@xxx.co.jp";
\r
15 public String MAIL_TO = "";
\r
16 public String MAIL_CC = "";
\r
17 public String MAIL_BCC = "";
\r
20 * 'POP before SMTP'認証を行うかどうか
\r
22 public boolean POP_before_SMTP = false;
\r
25 * 'USER_AUTH'認証を行うかどうか
\r
27 public boolean USER_AUTH = false;
\r
30 * POPサーバー名('POP before SMTP'認証時のみ)
\r
32 public String MAIL_POP = "";
\r
35 * POPアカウント('POP before SMTP'認証時のみ)
\r
37 public String USER_ID = "";
\r
40 * POPアカウントのパスワード('POP before SMTP'認証時のみ)
\r
42 public String PASSWORD = "";
\r
45 * 指定されたプロパティファイルに定義された値でインスタンスを生成する。
\r
46 * @param propertyFile 設定値を定義したプロパティファイルのパス名
\r
48 public SiteData(String propertyFile) {
\r
50 Properties properties = new Properties();
\r
51 properties.setPasswordItem("PASSWORD");
\r
52 properties.load(new FileInputStream(propertyFile));
\r
55 if ((str = properties.getProperty("MAIL_SMTP")) != null) {
\r
58 if ((str = properties.getProperty("MAIL_SMTP_PORT")) != null) {
\r
59 MAIL_SMTP_PORT = str;
\r
61 if ((str = properties.getProperty("MAIL_FROM")) != null) {
\r
64 if ((str = properties.getProperty("MAIL_FROM")) != null) {
\r
67 if ((str = properties.getProperty("MAIL_TO")) != null) {
\r
70 if ((str = properties.getProperty("MAIL_CC")) != null) {
\r
73 if ((str = properties.getProperty("MAIL_BCC")) != null) {
\r
77 str = properties.getProperty("MAIL_POP_before_SMTP");
\r
78 if ((str != null) && str.equals("true")) {
\r
79 POP_before_SMTP = true;
\r
81 str = properties.getProperty("MAIL_SMTP_AUTH");
\r
82 if ((str != null) && str.equals("true")) {
\r
85 if ((str = properties.getProperty("MAIL_POP")) != null) {
\r
88 if ((str = properties.getProperty("USER_ID")) != null) {
\r
91 if ((str = properties.getProperty("PASSWORD")) != null) {
\r
95 catch(Exception e) {
\r
96 System.out.println(e);
\r