Changeset 22796 for branches/version-2_12-dev/data/class/SC_SendMail.php
- Timestamp:
- 2013/05/02 18:11:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_SendMail.php
r22567 r22796 23 23 24 24 // テキスト/HTML メール送信 25 class SC_SendMail 26 { 25 class SC_SendMail { 27 26 28 27 var $to; // 送信先 … … 40 39 * @return void 41 40 */ 42 function __construct() 43 { 41 function __construct() { 44 42 $this->arrRecip = array(); 45 43 $this->to = ''; … … 64 62 65 63 // 送信先の設定 66 function setRecip($key, $recipient) 67 { 64 function setRecip($key, $recipient) { 68 65 $this->arrRecip[$key] = $recipient; 69 66 } 70 67 71 68 // 宛先の設定 72 function setTo($to, $to_name = '') 73 { 69 function setTo($to, $to_name = '') { 74 70 if ($to != '') { 75 71 $this->to = $this->getNameAddress($to_name, $to); … … 79 75 80 76 // 送信元の設定 81 function setFrom($from, $from_name = '') 82 { 77 function setFrom($from, $from_name = '') { 83 78 $this->from = $this->getNameAddress($from_name, $from); 84 79 } 85 80 86 81 // CCの設定 87 function setCc($cc, $cc_name = '') 88 { 82 function setCc($cc, $cc_name = '') { 89 83 if ($cc != '') { 90 84 $this->cc = $this->getNameAddress($cc_name, $cc); … … 94 88 95 89 // BCCの設定 96 function setBCc($bcc) 97 { 90 function setBCc($bcc) { 98 91 if ($bcc != '') { 99 92 $this->bcc = $bcc; … … 103 96 104 97 // Reply-Toの設定 105 function setReplyTo($reply_to) 106 { 98 function setReplyTo($reply_to) { 107 99 if ($reply_to != '') { 108 100 $this->reply_to = $reply_to; … … 111 103 112 104 // Return-Pathの設定 113 function setReturnPath($return_path) 114 { 105 function setReturnPath($return_path) { 115 106 $this->return_path = $return_path; 116 107 } 117 108 118 109 // 件名の設定 119 function setSubject($subject) 120 { 110 function setSubject($subject) { 121 111 $this->subject = mb_encode_mimeheader($subject, 'JIS', 'B', "\n"); 122 112 $this->subject = str_replace(array("\r\n", "\r"), "\n", $this->subject); … … 124 114 125 115 // 本文の設定 126 function setBody($body) 127 { 116 function setBody($body) { 128 117 // iso-2022-jpだと特殊文字が?で送信されるのでJISを使用する 129 118 $this->body = mb_convert_encoding($body, 'JIS', CHAR_CODE); … … 135 124 * @deprecated 2.12.2 (#1912) 136 125 */ 137 function setHost($host) 138 { 126 function setHost($host) { 139 127 trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); 140 128 $this->host = $host; … … 153 141 * @deprecated 2.12.2 (#1912) 154 142 */ 155 function setPort($port) 156 { 143 function setPort($port) { 157 144 trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); 158 145 $this->port = $port; … … 166 153 167 154 // 名前<メールアドレス>の形式を生成 168 function getNameAddress($name, $mail_address) 169 { 155 function getNameAddress($name, $mail_address) { 170 156 if ($name != '') { 171 157 // 制御文字を変換する。 … … 180 166 } 181 167 182 function setItem($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') 183 { 168 function setItem($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') { 184 169 $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); 185 170 } 186 171 187 function setItemHtml($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') 188 { 172 function setItemHtml($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') { 189 173 $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); 190 174 } … … 202 186 $bcc -> ブラインドカーボンコピー 203 187 */ 204 function setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') 205 { 188 function setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') { 206 189 // 宛先設定 207 190 $this->setTo($to); … … 230 213 231 214 // ヘッダーを返す 232 function getBaseHeader() 233 { 215 function getBaseHeader() { 234 216 // 送信するメールの内容と送信先 235 217 $arrHeader = array(); … … 254 236 255 237 // ヘッダーを返す 256 function getTEXTHeader() 257 { 238 function getTEXTHeader() { 258 239 $arrHeader = $this->getBaseHeader(); 259 240 $arrHeader['Content-Type'] = 'text/plain; charset="ISO-2022-JP"'; … … 262 243 263 244 // ヘッダーを返す 264 function getHTMLHeader() 265 { 245 function getHTMLHeader() { 266 246 $arrHeader = $this->getBaseHeader(); 267 247 $arrHeader['Content-Type'] = 'text/html; charset="ISO-2022-JP"'; … … 274 254 * @return array|string メーラーバックエンドに応じた送信先 275 255 */ 276 function getRecip() 277 { 256 function getRecip() { 278 257 switch ($this->backend) { 279 258 // PEAR::Mail_mail#send は、(他のメーラーバックエンドと異なり) 第1引数を To: として扱う。Cc: や Bcc: は、ヘッダー情報から処理する。 … … 295 274 * @return void 296 275 */ 297 function sendMail($isHtml = false) 298 { 276 function sendMail($isHtml = false) { 299 277 $header = $isHtml ? $this->getHTMLHeader() : $this->getTEXTHeader(); 300 278 $recip = $this->getRecip(); … … 317 295 * @return void 318 296 */ 319 function sendHtmlMail() 320 { 297 function sendHtmlMail() { 321 298 return $this->sendMail(true); 322 299 } … … 328 305 * @return array メーラーバックエンドに応じたパラメーターの配列 329 306 */ 330 function getBackendParams($backend) 331 { 307 function getBackendParams($backend) { 332 308 switch ($backend) { 333 309 case 'mail':
Note: See TracChangeset
for help on using the changeset viewer.