|
@@ 164-214 (lines=51) @@
|
| 161 |
|
* |
| 162 |
|
* @param $Customer 会員情報 |
| 163 |
|
*/ |
| 164 |
|
public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer) |
| 165 |
|
{ |
| 166 |
|
log_info('会員登録完了メール送信開始'); |
| 167 |
|
|
| 168 |
|
$MailTemplate = $this->mailTemplateRepository->find($this->eccubeConfig['eccube_entry_complete_mail_template_id']); |
| 169 |
|
|
| 170 |
|
$body = $this->twig->render($MailTemplate->getFileName(), [ |
| 171 |
|
'Customer' => $Customer, |
| 172 |
|
'BaseInfo' => $this->BaseInfo, |
| 173 |
|
]); |
| 174 |
|
|
| 175 |
|
$message = (new \Swift_Message()) |
| 176 |
|
->setSubject('['.$this->BaseInfo->getShopName().'] '.$MailTemplate->getMailSubject()) |
| 177 |
|
->setFrom([$this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()]) |
| 178 |
|
->setTo([$Customer->getEmail()]) |
| 179 |
|
->setBcc($this->BaseInfo->getEmail01()) |
| 180 |
|
->setReplyTo($this->BaseInfo->getEmail03()) |
| 181 |
|
->setReturnPath($this->BaseInfo->getEmail04()); |
| 182 |
|
|
| 183 |
|
// HTMLテンプレートが存在する場合 |
| 184 |
|
$htmlFileName = $this->getHtmlTemplate($MailTemplate->getFileName()); |
| 185 |
|
if (!is_null($htmlFileName)) { |
| 186 |
|
$htmlBody = $this->twig->render($htmlFileName, [ |
| 187 |
|
'Customer' => $Customer, |
| 188 |
|
'BaseInfo' => $this->BaseInfo, |
| 189 |
|
]); |
| 190 |
|
|
| 191 |
|
$message |
| 192 |
|
->setContentType('text/plain; charset=UTF-8') |
| 193 |
|
->setBody($body, 'text/plain') |
| 194 |
|
->addPart($htmlBody, 'text/html'); |
| 195 |
|
} else { |
| 196 |
|
$message->setBody($body); |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
$event = new EventArgs( |
| 200 |
|
[ |
| 201 |
|
'message' => $message, |
| 202 |
|
'Customer' => $Customer, |
| 203 |
|
'BaseInfo' => $this->BaseInfo, |
| 204 |
|
], |
| 205 |
|
null |
| 206 |
|
); |
| 207 |
|
$this->eventDispatcher->dispatch(EccubeEvents::MAIL_CUSTOMER_COMPLETE, $event); |
| 208 |
|
|
| 209 |
|
$count = $this->mailer->send($message); |
| 210 |
|
|
| 211 |
|
log_info('会員登録完了メール送信完了', ['count' => $count]); |
| 212 |
|
|
| 213 |
|
return $count; |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
/** |
| 217 |
|
* Send withdraw mail. |
|
@@ 222-273 (lines=52) @@
|
| 219 |
|
* @param $Customer Customer |
| 220 |
|
* @param $email string |
| 221 |
|
*/ |
| 222 |
|
public function sendCustomerWithdrawMail(Customer $Customer, string $email) |
| 223 |
|
{ |
| 224 |
|
log_info('退会手続き完了メール送信開始'); |
| 225 |
|
|
| 226 |
|
$MailTemplate = $this->mailTemplateRepository->find($this->eccubeConfig['eccube_customer_withdraw_mail_template_id']); |
| 227 |
|
|
| 228 |
|
$body = $this->twig->render($MailTemplate->getFileName(), [ |
| 229 |
|
'Customer' => $Customer, |
| 230 |
|
'BaseInfo' => $this->BaseInfo, |
| 231 |
|
]); |
| 232 |
|
|
| 233 |
|
$message = (new \Swift_Message()) |
| 234 |
|
->setSubject('['.$this->BaseInfo->getShopName().'] '.$MailTemplate->getMailSubject()) |
| 235 |
|
->setFrom([$this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()]) |
| 236 |
|
->setTo([$email]) |
| 237 |
|
->setBcc($this->BaseInfo->getEmail01()) |
| 238 |
|
->setReplyTo($this->BaseInfo->getEmail03()) |
| 239 |
|
->setReturnPath($this->BaseInfo->getEmail04()); |
| 240 |
|
|
| 241 |
|
// HTMLテンプレートが存在する場合 |
| 242 |
|
$htmlFileName = $this->getHtmlTemplate($MailTemplate->getFileName()); |
| 243 |
|
if (!is_null($htmlFileName)) { |
| 244 |
|
$htmlBody = $this->twig->render($htmlFileName, [ |
| 245 |
|
'Customer' => $Customer, |
| 246 |
|
'BaseInfo' => $this->BaseInfo, |
| 247 |
|
]); |
| 248 |
|
|
| 249 |
|
$message |
| 250 |
|
->setContentType('text/plain; charset=UTF-8') |
| 251 |
|
->setBody($body, 'text/plain') |
| 252 |
|
->addPart($htmlBody, 'text/html'); |
| 253 |
|
} else { |
| 254 |
|
$message->setBody($body); |
| 255 |
|
} |
| 256 |
|
|
| 257 |
|
$event = new EventArgs( |
| 258 |
|
[ |
| 259 |
|
'message' => $message, |
| 260 |
|
'Customer' => $Customer, |
| 261 |
|
'BaseInfo' => $this->BaseInfo, |
| 262 |
|
'email' => $email, |
| 263 |
|
], |
| 264 |
|
null |
| 265 |
|
); |
| 266 |
|
$this->eventDispatcher->dispatch(EccubeEvents::MAIL_CUSTOMER_WITHDRAW, $event); |
| 267 |
|
|
| 268 |
|
$count = $this->mailer->send($message); |
| 269 |
|
|
| 270 |
|
log_info('退会手続き完了メール送信完了', ['count' => $count]); |
| 271 |
|
|
| 272 |
|
return $count; |
| 273 |
|
} |
| 274 |
|
|
| 275 |
|
/** |
| 276 |
|
* Send contact mail. |
|
@@ 280-331 (lines=52) @@
|
| 277 |
|
* |
| 278 |
|
* @param $formData お問い合わせ内容 |
| 279 |
|
*/ |
| 280 |
|
public function sendContactMail($formData) |
| 281 |
|
{ |
| 282 |
|
log_info('お問い合わせ受付メール送信開始'); |
| 283 |
|
|
| 284 |
|
$MailTemplate = $this->mailTemplateRepository->find($this->eccubeConfig['eccube_contact_mail_template_id']); |
| 285 |
|
|
| 286 |
|
$body = $this->twig->render($MailTemplate->getFileName(), [ |
| 287 |
|
'data' => $formData, |
| 288 |
|
'BaseInfo' => $this->BaseInfo, |
| 289 |
|
]); |
| 290 |
|
|
| 291 |
|
// 問い合わせ者にメール送信 |
| 292 |
|
$message = (new \Swift_Message()) |
| 293 |
|
->setSubject('['.$this->BaseInfo->getShopName().'] '.$MailTemplate->getMailSubject()) |
| 294 |
|
->setFrom([$this->BaseInfo->getEmail02() => $this->BaseInfo->getShopName()]) |
| 295 |
|
->setTo([$formData['email']]) |
| 296 |
|
->setBcc($this->BaseInfo->getEmail02()) |
| 297 |
|
->setReplyTo($this->BaseInfo->getEmail02()) |
| 298 |
|
->setReturnPath($this->BaseInfo->getEmail04()); |
| 299 |
|
|
| 300 |
|
// HTMLテンプレートが存在する場合 |
| 301 |
|
$htmlFileName = $this->getHtmlTemplate($MailTemplate->getFileName()); |
| 302 |
|
if (!is_null($htmlFileName)) { |
| 303 |
|
$htmlBody = $this->twig->render($htmlFileName, [ |
| 304 |
|
'data' => $formData, |
| 305 |
|
'BaseInfo' => $this->BaseInfo, |
| 306 |
|
]); |
| 307 |
|
|
| 308 |
|
$message |
| 309 |
|
->setContentType('text/plain; charset=UTF-8') |
| 310 |
|
->setBody($body, 'text/plain') |
| 311 |
|
->addPart($htmlBody, 'text/html'); |
| 312 |
|
} else { |
| 313 |
|
$message->setBody($body); |
| 314 |
|
} |
| 315 |
|
|
| 316 |
|
$event = new EventArgs( |
| 317 |
|
[ |
| 318 |
|
'message' => $message, |
| 319 |
|
'formData' => $formData, |
| 320 |
|
'BaseInfo' => $this->BaseInfo, |
| 321 |
|
], |
| 322 |
|
null |
| 323 |
|
); |
| 324 |
|
$this->eventDispatcher->dispatch(EccubeEvents::MAIL_CONTACT, $event); |
| 325 |
|
|
| 326 |
|
$count = $this->mailer->send($message); |
| 327 |
|
|
| 328 |
|
log_info('お問い合わせ受付メール送信完了', ['count' => $count]); |
| 329 |
|
|
| 330 |
|
return $count; |
| 331 |
|
} |
| 332 |
|
|
| 333 |
|
/** |
| 334 |
|
* Alias of sendContactMail(). |