1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved. |
---|
6 | * |
---|
7 | * http://www.lockon.co.jp/ |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License |
---|
11 | * as published by the Free Software Foundation; either version 2 |
---|
12 | * of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | */ |
---|
23 | |
---|
24 | /** |
---|
25 | * メール関連 のヘルパークラス. |
---|
26 | * |
---|
27 | * @package Helper |
---|
28 | * @author LOCKON CO.,LTD. |
---|
29 | * @version $Id$ |
---|
30 | */ |
---|
31 | class SC_Helper_Mail { |
---|
32 | |
---|
33 | /** メールテンプレートのパス */ |
---|
34 | var $arrMAILTPLPATH; |
---|
35 | |
---|
36 | /** |
---|
37 | * コンストラクタ. |
---|
38 | */ |
---|
39 | function SC_Helper_Mail() { |
---|
40 | $masterData = new SC_DB_MasterData_Ex(); |
---|
41 | $this->arrMAILTPLPATH = $masterData->getMasterData("mtb_mail_tpl_path"); |
---|
42 | $this->arrPref = $masterData->getMasterData('mtb_pref'); |
---|
43 | } |
---|
44 | |
---|
45 | /* DBに登録されたテンプレートメールの送信 */ |
---|
46 | function sfSendTemplateMail($to, $to_name, $template_id, &$objPage, $from_address = "", $from_name = "", $reply_to = "", $bcc = '') { |
---|
47 | |
---|
48 | $objQuery = new SC_Query_Ex(); |
---|
49 | // メールテンプレート情報の取得 |
---|
50 | $where = "template_id = ?"; |
---|
51 | $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id)); |
---|
52 | $objPage->tpl_header = $arrRet[0]['header']; |
---|
53 | $objPage->tpl_footer = $arrRet[0]['footer']; |
---|
54 | $tmp_subject = $arrRet[0]['subject']; |
---|
55 | |
---|
56 | $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
57 | |
---|
58 | $objMailView = new SC_SiteView_Ex(); |
---|
59 | // メール本文の取得 |
---|
60 | $objMailView->assignobj($objPage); |
---|
61 | $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); |
---|
62 | |
---|
63 | // メール送信処理 |
---|
64 | $objSendMail = new SC_SendMail_Ex(); |
---|
65 | if ($from_address == "") $from_address = $arrInfo['email03']; |
---|
66 | if ($from_name == "") $from_name = $arrInfo['shop_name']; |
---|
67 | if ($reply_to == "") $reply_to = $arrInfo['email03']; |
---|
68 | $error = $arrInfo['email04']; |
---|
69 | $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); |
---|
70 | |
---|
71 | $objSendMail->setItem('', $tosubject, $body, $from_address, $from_name, $reply_to, $error, $error, $bcc); |
---|
72 | $objSendMail->setTo($to, $to_name); |
---|
73 | $objSendMail->sendMail(); // メール送信 |
---|
74 | } |
---|
75 | |
---|
76 | /* 受注完了メール送信 */ |
---|
77 | function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) { |
---|
78 | |
---|
79 | $arrTplVar = new stdClass(); |
---|
80 | $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
81 | $arrTplVar->arrInfo = $arrInfo; |
---|
82 | |
---|
83 | $objQuery = new SC_Query_Ex(); |
---|
84 | |
---|
85 | if($subject == "" && $header == "" && $footer == "") { |
---|
86 | // メールテンプレート情報の取得 |
---|
87 | $where = "template_id = ?"; |
---|
88 | $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id)); |
---|
89 | $arrTplVar->tpl_header = $arrRet[0]['header']; |
---|
90 | $arrTplVar->tpl_footer = $arrRet[0]['footer']; |
---|
91 | $tmp_subject = $arrRet[0]['subject']; |
---|
92 | } else { |
---|
93 | $arrTplVar->tpl_header = $header; |
---|
94 | $arrTplVar->tpl_footer = $footer; |
---|
95 | $tmp_subject = $subject; |
---|
96 | } |
---|
97 | |
---|
98 | // 受注情報の取得 |
---|
99 | $where = "order_id = ?"; |
---|
100 | $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id)); |
---|
101 | $arrOrder = $arrRet[0]; |
---|
102 | $objQuery->setOrder('order_detail_id'); |
---|
103 | $arrTplVar->arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id)); |
---|
104 | |
---|
105 | $objProduct = new SC_Product_Ex(); |
---|
106 | $objQuery->setOrder('shipping_id'); |
---|
107 | $arrRet = $objQuery->select("*", "dtb_shipping", "order_id = ?", array($order_id)); |
---|
108 | foreach (array_keys($arrRet) as $key) { |
---|
109 | $objQuery->setOrder('shipping_id'); |
---|
110 | $arrItems = $objQuery->select("*", "dtb_shipment_item", "order_id = ? AND shipping_id = ?", |
---|
111 | array($order_id, $arrRet[$key]['shipping_id'])); |
---|
112 | foreach ($arrItems as $itemKey => $arrDetail) { |
---|
113 | foreach ($arrDetail as $detailKey => $detailVal) { |
---|
114 | $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']][$detailKey] = $detailVal; |
---|
115 | } |
---|
116 | |
---|
117 | $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']]['productsClass'] =& $objProduct->getDetailAndProductsClass($arrDetail['product_class_id']); |
---|
118 | } |
---|
119 | } |
---|
120 | $arrTplVar->arrShipping = $arrRet; |
---|
121 | |
---|
122 | $arrTplVar->Message_tmp = $arrOrder['message']; |
---|
123 | |
---|
124 | // 会員情報の取得 |
---|
125 | $customer_id = $arrOrder['customer_id']; |
---|
126 | $objQuery->setOrder('customer_id'); |
---|
127 | $arrRet = $objQuery->select('point', "dtb_customer", "customer_id = ?", array($customer_id)); |
---|
128 | $arrCustomer = isset($arrRet[0]) ? $arrRet[0] : ""; |
---|
129 | |
---|
130 | $arrTplVar->arrCustomer = $arrCustomer; |
---|
131 | $arrTplVar->arrOrder = $arrOrder; |
---|
132 | |
---|
133 | //その他決済情報 |
---|
134 | if($arrOrder['memo02'] != "") { |
---|
135 | $arrOther = unserialize($arrOrder['memo02']); |
---|
136 | |
---|
137 | foreach($arrOther as $other_key => $other_val){ |
---|
138 | if(SC_Utils_Ex::sfTrim($other_val['value']) == ""){ |
---|
139 | $arrOther[$other_key]['value'] = ""; |
---|
140 | } |
---|
141 | } |
---|
142 | |
---|
143 | $arrTplVar->arrOther = $arrOther; |
---|
144 | } |
---|
145 | |
---|
146 | // 都道府県変換 |
---|
147 | $arrTplVar->arrPref = $this->arrPref; |
---|
148 | |
---|
149 | $objCustomer = new SC_Customer_Ex(); |
---|
150 | $arrTplVar->tpl_user_point = $objCustomer->getValue('point'); |
---|
151 | |
---|
152 | if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { |
---|
153 | $objMailView = new SC_MobileView_Ex(); |
---|
154 | } else { |
---|
155 | $objMailView = new SC_SiteView_Ex(); |
---|
156 | } |
---|
157 | // メール本文の取得 |
---|
158 | $objMailView->assignobj($arrTplVar); |
---|
159 | $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); |
---|
160 | |
---|
161 | // メール送信処理 |
---|
162 | $objSendMail = new SC_SendMail_Ex(); |
---|
163 | $bcc = $arrInfo['email01']; |
---|
164 | $from = $arrInfo['email03']; |
---|
165 | $error = $arrInfo['email04']; |
---|
166 | $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); |
---|
167 | |
---|
168 | $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); |
---|
169 | $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " ". $arrOrder["order_name02"] ." 様"); |
---|
170 | |
---|
171 | // 送信フラグ:trueの場合は、送信する。 |
---|
172 | if($send) { |
---|
173 | if ($objSendMail->sendMail()) { |
---|
174 | $this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body); |
---|
175 | } |
---|
176 | } |
---|
177 | |
---|
178 | return $objSendMail; |
---|
179 | } |
---|
180 | |
---|
181 | // テンプレートを使用したメールの送信 |
---|
182 | function sfSendTplMail($to, $tmp_subject, $tplpath, &$objPage) { |
---|
183 | $objMailView = new SC_SiteView_Ex(); |
---|
184 | $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
185 | // メール本文の取得 |
---|
186 | $objPage->tpl_shopname=$arrInfo['shop_name']; |
---|
187 | $objPage->tpl_infoemail = $arrInfo['email02']; |
---|
188 | $objMailView->assignobj($objPage); |
---|
189 | $body = $objMailView->fetch($tplpath); |
---|
190 | // メール送信処理 |
---|
191 | $objSendMail = new SC_SendMail_Ex(); |
---|
192 | $bcc = $arrInfo['email01']; |
---|
193 | $from = $arrInfo['email03']; |
---|
194 | $error = $arrInfo['email04']; |
---|
195 | $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); |
---|
196 | |
---|
197 | $objSendMail->setItem($to, $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); |
---|
198 | $objSendMail->sendMail(); |
---|
199 | } |
---|
200 | |
---|
201 | // 通常のメール送信 |
---|
202 | function sfSendMail($to, $tmp_subject, $body) { |
---|
203 | $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
204 | // メール送信処理 |
---|
205 | $objSendMail = new SC_SendMail_Ex(); |
---|
206 | $bcc = $arrInfo['email01']; |
---|
207 | $from = $arrInfo['email03']; |
---|
208 | $error = $arrInfo['email04']; |
---|
209 | $tosubject = $this->sfMakeSubject($tmp_subject); |
---|
210 | |
---|
211 | $objSendMail->setItem($to, $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); |
---|
212 | $objSendMail->sendMail(); |
---|
213 | } |
---|
214 | |
---|
215 | //件名にテンプレートを用いる |
---|
216 | function sfMakeSubject($subject, &$objMailView) { |
---|
217 | if (empty($objMailView)) { |
---|
218 | $objMailView = new SC_SiteView_Ex(); |
---|
219 | } |
---|
220 | $objTplAssign = new stdClass; |
---|
221 | |
---|
222 | $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
223 | $objTplAssign->tpl_shopname=$arrInfo['shop_name']; |
---|
224 | $objTplAssign->tpl_infoemail=$subject; // 従来互換 |
---|
225 | $objTplAssign->tpl_mailtitle=$subject; |
---|
226 | $objMailView->assignobj($objTplAssign); |
---|
227 | $subject = $objMailView->fetch('mail_templates/mail_title.tpl'); |
---|
228 | return $subject; |
---|
229 | } |
---|
230 | |
---|
231 | // メール配信履歴への登録 |
---|
232 | function sfSaveMailHistory($order_id, $template_id, $subject, $body) { |
---|
233 | $sqlval['subject'] = $subject; |
---|
234 | $sqlval['order_id'] = $order_id; |
---|
235 | $sqlval['template_id'] = $template_id; |
---|
236 | $sqlval['send_date'] = 'CURRENT_TIMESTAMP'; |
---|
237 | if (!isset($_SESSION['member_id'])) $_SESSION['member_id'] = ""; |
---|
238 | if($_SESSION['member_id'] != "") { |
---|
239 | $sqlval['creator_id'] = $_SESSION['member_id']; |
---|
240 | } else { |
---|
241 | $sqlval['creator_id'] = '0'; |
---|
242 | } |
---|
243 | $sqlval['mail_body'] = $body; |
---|
244 | |
---|
245 | $objQuery = new SC_Query_Ex(); |
---|
246 | $sqlval['send_id'] = $objQuery->nextVal("dtb_mail_history_send_id"); |
---|
247 | $objQuery->insert("dtb_mail_history", $sqlval); |
---|
248 | } |
---|
249 | |
---|
250 | /* 会員登録があるかどうかのチェック(仮会員を含まない) */ |
---|
251 | function sfCheckCustomerMailMaga($email) { |
---|
252 | $col = "email, mailmaga_flg, customer_id"; |
---|
253 | $from = "dtb_customer"; |
---|
254 | $where = "(email = ? OR email_mobile = ?) AND status = 2 AND del_flg = 0"; |
---|
255 | $objQuery = new SC_Query_Ex(); |
---|
256 | $arrRet = $objQuery->select($col, $from, $where, array($email)); |
---|
257 | // 会員のメールアドレスが登録されている |
---|
258 | if(!empty($arrRet[0]['customer_id'])) { |
---|
259 | return true; |
---|
260 | } |
---|
261 | return false; |
---|
262 | } |
---|
263 | |
---|
264 | /** |
---|
265 | * 登録メールを送信する。 |
---|
266 | * |
---|
267 | * @param string $secret_key 会員固有キー |
---|
268 | * @param integer $customer_id 顧客ID |
---|
269 | * @param boolean $is_mobile false(default):PCアドレスにメールを送る true:携帯アドレスにメールを送る |
---|
270 | * @return boolean true:成功 false:失敗 |
---|
271 | */ |
---|
272 | function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = false) { |
---|
273 | // 会員データの取得 |
---|
274 | if(SC_Utils_Ex::sfIsInt($customer_id)) { |
---|
275 | $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id); |
---|
276 | }else{ |
---|
277 | $arrCustomerData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId('', "secret_key = ?", array($secret_key)); |
---|
278 | } |
---|
279 | if(SC_Utils_Ex::isBlank($arrCustomerData)) { |
---|
280 | return false; |
---|
281 | } |
---|
282 | |
---|
283 | $CONF = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
284 | |
---|
285 | $objMailText = new SC_SiteView_Ex(); |
---|
286 | $objMailText->assign('CONF', $CONF); |
---|
287 | $objMailText->assign("name01", $arrCustomerData['name01']); |
---|
288 | $objMailText->assign("name02", $arrCustomerData['name02']); |
---|
289 | $objMailText->assign('uniqid', $arrCustomerData['secret_key']); |
---|
290 | $objMailText->assignobj($arrCustomerData); |
---|
291 | $objMailText->assignobj($this); |
---|
292 | |
---|
293 | $objHelperMail = new SC_Helper_Mail_Ex(); |
---|
294 | |
---|
295 | // 仮会員が有効の場合 |
---|
296 | if(CUSTOMER_CONFIRM_MAIL == true and $arrCustomerData['status'] == 1) { |
---|
297 | $subject = $objHelperMail->sfMakeSubject('会員登録のご確認', $objMailText); |
---|
298 | $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl"); |
---|
299 | } else { |
---|
300 | $subject = $objHelperMail->sfMakeSubject('会員登録のご完了', $objMailText); |
---|
301 | $toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl"); |
---|
302 | } |
---|
303 | |
---|
304 | $objMail = new SC_SendMail(); |
---|
305 | $objMail->setItem( |
---|
306 | '' // 宛先 |
---|
307 | , $subject // サブジェクト |
---|
308 | , $toCustomerMail // 本文 |
---|
309 | , $CONF["email03"] // 配送元アドレス |
---|
310 | , $CONF["shop_name"] // 配送元 名前 |
---|
311 | , $CONF["email03"] // reply_to |
---|
312 | , $CONF["email04"] // return_path |
---|
313 | , $CONF["email04"] // Errors_to |
---|
314 | , $CONF["email01"] // Bcc |
---|
315 | ); |
---|
316 | // 宛先の設定 |
---|
317 | if($is_mobile) { |
---|
318 | $to_addr = $arrCustomerData["email_mobile"]; |
---|
319 | }else{ |
---|
320 | $to_addr = $arrCustomerData['email']; |
---|
321 | } |
---|
322 | $objMail->setTo($to_addr, $arrCustomerData["name01"] . $arrCustomerData["name02"] ." 様"); |
---|
323 | |
---|
324 | $objMail->sendMail(); |
---|
325 | return true; |
---|
326 | } |
---|
327 | |
---|
328 | /** |
---|
329 | * 保存されているメルマガテンプレートの取得 |
---|
330 | * @param integer 特定IDのテンプレートを取り出したい時はtemplate_idを指定。未指定時は全件取得 |
---|
331 | * @return array メールテンプレート情報を格納した配列 |
---|
332 | * @todo 表示順も引数で変更できるように |
---|
333 | */ |
---|
334 | function sfGetMailmagaTemplate($template_id = null){ |
---|
335 | // 初期化 |
---|
336 | $where = ''; |
---|
337 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
338 | |
---|
339 | // 条件文 |
---|
340 | $where = 'del_flg = ?'; |
---|
341 | $arrValues[] = 0; |
---|
342 | //template_id指定時 |
---|
343 | if (SC_Utils_Ex::sfIsInt($template_id) === true) { |
---|
344 | $where .= ' AND template_id = ?'; |
---|
345 | $arrValues[] = $template_id; |
---|
346 | } |
---|
347 | |
---|
348 | // 表示順 |
---|
349 | $objQuery->setOrder("create_date DESC"); |
---|
350 | |
---|
351 | $arrResults = $objQuery->select('*', 'dtb_mailmaga_template', $where, $arrValues); |
---|
352 | return $arrResults; |
---|
353 | } |
---|
354 | |
---|
355 | /** |
---|
356 | * 保存されているメルマガ送信履歴の取得 |
---|
357 | * @param integer 特定の送信履歴を取り出したい時はsend_idを指定。未指定時は全件取得 |
---|
358 | * @return array 送信履歴情報を格納した配列 |
---|
359 | */ |
---|
360 | function sfGetSendHistory($send_id = null){ |
---|
361 | // 初期化 |
---|
362 | $where = ''; |
---|
363 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
364 | |
---|
365 | // 条件文 |
---|
366 | $where = 'del_flg = ?'; |
---|
367 | $arrValues[] = 0; |
---|
368 | |
---|
369 | //send_id指定時 |
---|
370 | if (SC_Utils_Ex::sfIsInt($send_id) === true) { |
---|
371 | $where .= ' AND send_id = ?'; |
---|
372 | $arrValues[] = $send_id; |
---|
373 | } |
---|
374 | |
---|
375 | // 表示順 |
---|
376 | $objQuery->setOrder("create_date DESC"); |
---|
377 | |
---|
378 | $arrResults = $objQuery->select('*', 'dtb_send_history', $where, $arrValues); |
---|
379 | return $arrResults; |
---|
380 | } |
---|
381 | |
---|
382 | /** |
---|
383 | * 指定したIDのメルマガ配送を行う |
---|
384 | * |
---|
385 | * @param integer $send_id dtb_send_history の情報 |
---|
386 | * @return void |
---|
387 | */ |
---|
388 | function sfSendMailmagazine($send_id) { |
---|
389 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
390 | $objDb = new SC_Helper_DB_Ex(); |
---|
391 | $objSite = $objDb->sfGetBasisData(); |
---|
392 | $objMail = new SC_SendMail_Ex(); |
---|
393 | |
---|
394 | $where = 'del_flg = 0 AND send_id = ?'; |
---|
395 | $arrMail = $objQuery->getRow('*', 'dtb_send_history', $where, array($send_id)); |
---|
396 | |
---|
397 | // 対象となる$send_idが見つからない |
---|
398 | if (SC_Utils_Ex::isBlank($arrMail)) return; |
---|
399 | |
---|
400 | // 送信先リストの取得 |
---|
401 | $arrDestinationList = $objQuery->select( |
---|
402 | '*', |
---|
403 | 'dtb_send_customer', |
---|
404 | 'send_id = ? AND (send_flag = 2 OR send_flag IS NULL)', |
---|
405 | array($send_id) |
---|
406 | ); |
---|
407 | |
---|
408 | // 現在の配信数 |
---|
409 | $complete_count = $arrMail['complete_count']; |
---|
410 | if(SC_Utils_Ex::isBlank($arrMail)) $complete_count = 0; |
---|
411 | |
---|
412 | foreach ($arrDestinationList as $arrDestination) { |
---|
413 | |
---|
414 | // お名前の変換 |
---|
415 | $customerName = trim($arrDestination['name']); |
---|
416 | $subjectBody = preg_replace("/{name}/", $customerName, $arrMail['subject']); |
---|
417 | $mailBody = preg_replace("/{name}/", $customerName, $arrMail['body']); |
---|
418 | |
---|
419 | $objMail->setItem( |
---|
420 | $arrDestination['email'], |
---|
421 | $subjectBody, |
---|
422 | $mailBody, |
---|
423 | $objSite["email03"], // 送信元メールアドレス |
---|
424 | $objSite["shop_name"], // 送信元名 |
---|
425 | $objSite["email03"], // reply_to |
---|
426 | $objSite["email04"], // return_path |
---|
427 | $objSite["email04"] // errors_to |
---|
428 | ); |
---|
429 | |
---|
430 | // テキストメール配信の場合 |
---|
431 | if ($arrMail["mail_method"] == 2) { |
---|
432 | $sendResut = $objMail->sendMail(); |
---|
433 | // HTMLメール配信の場合 |
---|
434 | } else { |
---|
435 | $sendResut = $objMail->sendHtmlMail(); |
---|
436 | } |
---|
437 | |
---|
438 | // 送信完了なら1、失敗なら2をメール送信結果フラグとしてDBに挿入 |
---|
439 | if (!$sendResut) { |
---|
440 | $sendFlag = '2'; |
---|
441 | } else { |
---|
442 | // 完了を 1 増やす |
---|
443 | $sendFlag = '1'; |
---|
444 | $complete_count++; |
---|
445 | } |
---|
446 | |
---|
447 | // 送信結果情報を更新 |
---|
448 | $objQuery->update('dtb_send_customer', |
---|
449 | array('send_flag'=>$sendFlag), |
---|
450 | 'send_id = ? AND customer_id = ?', |
---|
451 | array($send_id,$arrDestination["customer_id"])); |
---|
452 | } |
---|
453 | |
---|
454 | // メール全件送信完了後の処理 |
---|
455 | $objQuery->update('dtb_send_history', |
---|
456 | array('end_date'=>'CURRENT_TIMESTAMP', 'complete_count'=>$complete_count), |
---|
457 | 'send_id = ?', |
---|
458 | array($send_id)); |
---|
459 | |
---|
460 | // 送信完了 報告メール |
---|
461 | $compSubject = date("Y年m月d日H時i分") . " 下記メールの配信が完了しました。"; |
---|
462 | // 管理者宛に変更 |
---|
463 | $objMail->setTo($objSite["email03"]); |
---|
464 | $objMail->setSubject($compSubject); |
---|
465 | |
---|
466 | // テキストメール配信の場合 |
---|
467 | if ($arrMail["mail_method"] == 2 ) { |
---|
468 | $sendResut = $objMail->sendMail(); |
---|
469 | // HTMLメール配信の場合 |
---|
470 | } else { |
---|
471 | $sendResut = $objMail->sendHtmlMail(); |
---|
472 | } |
---|
473 | return; |
---|
474 | } |
---|
475 | } |
---|
476 | ?> |
---|