1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 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
|
|
|
namespace Eccube\Service; |
25
|
|
|
|
26
|
|
|
use Eccube\Application; |
27
|
|
|
|
28
|
|
|
class MailService |
|
|
|
|
29
|
|
|
{ |
30
|
|
|
/** @var \Eccube\Application */ |
31
|
|
|
public $app; |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
/** @var \Eccube\Entity\BaseInfo */ |
35
|
|
|
public $BaseInfo; |
|
|
|
|
36
|
|
|
|
37
|
19 |
|
public function __construct(Application $app) |
|
|
|
|
38
|
|
|
{ |
39
|
19 |
|
$this->app = $app; |
40
|
|
|
$this->BaseInfo = $app['eccube.repository.base_info']->get(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
/** |
|
|
|
|
45
|
|
|
* Send customer confirm mail. |
46
|
|
|
* |
47
|
|
|
* @param $Customer 会員情報 |
|
|
|
|
48
|
|
|
* @param $activateUrl アクティベート用url |
|
|
|
|
49
|
|
|
*/ |
50
|
2 |
View Code Duplication |
public function sendCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $activateUrl) |
|
|
|
|
51
|
|
|
{ |
52
|
|
|
|
53
|
|
|
$body = $this->app->renderView('Mail/entry_confirm.twig', array( |
54
|
|
|
'Customer' => $Customer, |
55
|
2 |
|
'BaseInfo' => $this->BaseInfo, |
56
|
|
|
'activateUrl' => $activateUrl, |
57
|
|
|
)); |
58
|
|
|
|
59
|
2 |
|
$message = \Swift_Message::newInstance() |
60
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認') |
|
|
|
|
61
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
62
|
|
|
->setTo(array($Customer->getEmail())) |
63
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
64
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
65
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
66
|
|
|
->setBody($body); |
67
|
|
|
|
68
|
|
|
$this->app->mail($message); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
|
|
|
|
72
|
|
|
* Send customer complete mail. |
73
|
|
|
* |
74
|
|
|
* @param $Customer 会員情報 |
|
|
|
|
75
|
|
|
*/ |
76
|
2 |
View Code Duplication |
public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer) |
|
|
|
|
77
|
|
|
{ |
78
|
|
|
|
79
|
|
|
$body = $this->app->renderView('Mail/entry_complete.twig', array( |
80
|
|
|
'Customer' => $Customer, |
81
|
2 |
|
'BaseInfo' => $this->BaseInfo, |
82
|
|
|
)); |
83
|
|
|
|
84
|
2 |
|
$message = \Swift_Message::newInstance() |
85
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録が完了しました。') |
|
|
|
|
86
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
87
|
|
|
->setTo(array($Customer->getEmail())) |
88
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
89
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
90
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
91
|
|
|
->setBody($body); |
92
|
|
|
|
93
|
|
|
$this->app->mail($message); |
94
|
|
|
|
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/** |
|
|
|
|
100
|
|
|
* Send withdraw mail. |
101
|
|
|
* |
102
|
|
|
* @param $Customer 会員情報 |
|
|
|
|
103
|
|
|
* @param $email 会員email |
|
|
|
|
104
|
|
|
*/ |
105
|
1 |
View Code Duplication |
public function sendCustomerWithdrawMail(\Eccube\Entity\Customer $Customer, $email) |
|
|
|
|
106
|
|
|
{ |
107
|
|
|
|
108
|
|
|
$body = $this->app->renderView('Mail/customer_withdraw_mail.twig', array( |
109
|
|
|
'Customer' => $Customer, |
110
|
1 |
|
'BaseInfo' => $this->BaseInfo, |
111
|
|
|
)); |
112
|
|
|
|
113
|
1 |
|
$message = \Swift_Message::newInstance() |
114
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] 退会手続きのご完了') |
|
|
|
|
115
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
116
|
1 |
|
->setTo(array($email)) |
117
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
118
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
119
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
120
|
|
|
->setBody($body); |
121
|
|
|
|
122
|
|
|
$this->app->mail($message); |
123
|
|
|
|
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
|
127
|
|
|
/** |
|
|
|
|
128
|
|
|
* Send contact mail. |
129
|
|
|
* |
130
|
|
|
* @param $formData お問い合わせ内容 |
|
|
|
|
131
|
|
|
*/ |
132
|
5 |
|
public function sendContactMail($formData) |
133
|
|
|
{ |
134
|
|
|
|
135
|
|
|
$body = $this->app->renderView('Mail/contact_mail.twig', array( |
136
|
|
|
'data' => $formData, |
137
|
5 |
|
'BaseInfo' => $this->BaseInfo, |
138
|
|
|
)); |
139
|
|
|
|
140
|
|
|
// 問い合わせ者にメール送信 |
141
|
5 |
|
$message = \Swift_Message::newInstance() |
142
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] お問い合わせを受け付けました。') |
|
|
|
|
143
|
|
|
->setFrom(array($this->BaseInfo->getEmail02() => $this->BaseInfo->getShopName())) |
144
|
5 |
|
->setTo(array($formData['email'])) |
145
|
|
|
->setBcc($this->BaseInfo->getEmail02()) |
146
|
|
|
->setReplyTo($this->BaseInfo->getEmail02()) |
147
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
148
|
|
|
->setBody($body); |
149
|
|
|
|
150
|
|
|
$this->app->mail($message); |
151
|
|
|
|
152
|
5 |
|
} |
153
|
|
|
|
154
|
|
|
/** |
|
|
|
|
155
|
|
|
* Alias of sendContactMail(). |
156
|
|
|
* |
157
|
|
|
* @param $formData お問い合わせ内容 |
|
|
|
|
158
|
|
|
* @see sendContactMail() |
159
|
|
|
* @deprecated since 3.0.0, to be removed in 3.1 |
160
|
|
|
* @link https://github.com/EC-CUBE/ec-cube/issues/1315 |
161
|
|
|
*/ |
162
|
1 |
|
public function sendrContactMail($formData) |
163
|
|
|
{ |
164
|
|
|
$this->sendContactMail($formData); |
165
|
1 |
|
} |
166
|
|
|
|
167
|
|
|
/** |
|
|
|
|
168
|
|
|
* Send order mail. |
169
|
|
|
* |
170
|
|
|
* @param $Order 受注情報 |
|
|
|
|
171
|
|
|
*/ |
172
|
5 |
|
public function sendOrderMail(\Eccube\Entity\Order $Order) |
173
|
|
|
{ |
174
|
|
|
|
175
|
|
|
$MailTemplate = $this->app['eccube.repository.mail_template']->find(1); |
176
|
|
|
|
177
|
|
|
$body = $this->app->renderView($MailTemplate->getFileName(), array( |
178
|
5 |
|
'header' => $MailTemplate->getHeader(), |
179
|
5 |
|
'footer' => $MailTemplate->getFooter(), |
180
|
|
|
'Order' => $Order, |
181
|
|
|
)); |
182
|
|
|
|
183
|
5 |
|
$message = \Swift_Message::newInstance() |
184
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] ' . $MailTemplate->getSubject()) |
|
|
|
|
185
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
186
|
|
|
->setTo(array($Order->getEmail())) |
187
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
188
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
189
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
190
|
|
|
->setBody($body); |
191
|
|
|
|
192
|
|
|
$this->app->mail($message); |
193
|
|
|
|
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
/** |
|
|
|
|
198
|
|
|
* Send admin customer confirm mail. |
199
|
|
|
* |
200
|
|
|
* @param $Customer 会員情報 |
|
|
|
|
201
|
|
|
* @param $activateUrl アクティベート用url |
|
|
|
|
202
|
|
|
*/ |
203
|
1 |
View Code Duplication |
public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $activateUrl) |
|
|
|
|
204
|
|
|
{ |
205
|
|
|
|
206
|
|
|
$body = $this->app->renderView('Mail/entry_confirm.twig', array( |
207
|
|
|
'Customer' => $Customer, |
208
|
|
|
'activateUrl' => $activateUrl, |
209
|
|
|
)); |
210
|
|
|
|
211
|
1 |
|
$message = \Swift_Message::newInstance() |
212
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認') |
|
|
|
|
213
|
|
|
->setFrom(array($this->BaseInfo->getEmail03() => $this->BaseInfo->getShopName())) |
214
|
|
|
->setTo(array($Customer->getEmail())) |
215
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
216
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
217
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
218
|
|
|
->setBody($body); |
219
|
|
|
|
220
|
|
|
$this->app->mail($message); |
221
|
|
|
|
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
|
225
|
|
|
/** |
|
|
|
|
226
|
|
|
* Send admin order mail. |
227
|
|
|
* |
228
|
|
|
* @param $Order 受注情報 |
|
|
|
|
229
|
|
|
* @param $formData 入力内容 |
|
|
|
|
230
|
|
|
*/ |
231
|
1 |
|
public function sendAdminOrderMail(\Eccube\Entity\Order $Order, $formData) |
232
|
|
|
{ |
233
|
|
|
|
234
|
|
|
$body = $this->app->renderView('Mail/order.twig', array( |
235
|
1 |
|
'header' => $formData['header'], |
236
|
1 |
|
'footer' => $formData['footer'], |
237
|
|
|
'Order' => $Order, |
238
|
|
|
)); |
239
|
|
|
|
240
|
1 |
|
$message = \Swift_Message::newInstance() |
241
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] ' . $formData['subject']) |
|
|
|
|
242
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
243
|
|
|
->setTo(array($Order->getEmail())) |
244
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
245
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
246
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
247
|
|
|
->setBody($body); |
248
|
|
|
|
249
|
|
|
$this->app->mail($message); |
250
|
|
|
|
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
|
|
|
|
254
|
|
|
* Send password reset notification mail. |
255
|
|
|
* |
256
|
|
|
* @param $Customer 会員情報 |
|
|
|
|
257
|
|
|
*/ |
258
|
1 |
View Code Duplication |
public function sendPasswordResetNotificationMail(\Eccube\Entity\Customer $Customer, $reset_url) |
|
|
|
|
259
|
|
|
{ |
260
|
|
|
$body = $this->app->renderView('Mail/forgot_mail.twig', array( |
|
|
|
|
261
|
|
|
'Customer' => $Customer, |
262
|
|
|
'reset_url' => $reset_url |
263
|
|
|
)); |
264
|
|
|
|
265
|
1 |
|
$message = \Swift_Message::newInstance() |
266
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のご確認') |
|
|
|
|
267
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
268
|
|
|
->setTo(array($Customer->getEmail())) |
269
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
270
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
271
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
272
|
|
|
->setBody($body); |
273
|
|
|
|
274
|
|
|
$this->app->mail($message); |
275
|
|
|
|
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
|
|
|
|
279
|
|
|
* Send password reset notification mail. |
280
|
|
|
* |
281
|
|
|
* @param $Customer 会員情報 |
|
|
|
|
282
|
|
|
*/ |
283
|
1 |
View Code Duplication |
public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer, $password) |
|
|
|
|
284
|
|
|
{ |
285
|
|
|
$body = $this->app->renderView('Mail/reset_complete_mail.twig', array( |
286
|
|
|
'Customer' => $Customer, |
287
|
|
|
'password' => $password, |
288
|
|
|
)); |
289
|
|
|
|
290
|
1 |
|
$message = \Swift_Message::newInstance() |
291
|
|
|
->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ') |
|
|
|
|
292
|
|
|
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName())) |
293
|
|
|
->setTo(array($Customer->getEmail())) |
294
|
|
|
->setBcc($this->BaseInfo->getEmail01()) |
295
|
|
|
->setReplyTo($this->BaseInfo->getEmail03()) |
296
|
|
|
->setReturnPath($this->BaseInfo->getEmail04()) |
297
|
|
|
->setBody($body); |
298
|
|
|
|
299
|
|
|
$this->app->mail($message); |
300
|
|
|
|
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
} |
304
|
|
|
|