Skip to content

Commit

Permalink
Merge pull request #403 from k-yamamura/front_shopping
Browse files Browse the repository at this point in the history
メール送信情報の修正
  • Loading branch information
Yangsin committed Jun 26, 2015
2 parents da527cb + 038f64f commit 9d18506
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 50 deletions.
4 changes: 1 addition & 3 deletions src/Eccube/Controller/Admin/Customer/CustomerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ public function resend(Application $app, Request $request, $id)
throw new NotFoundHttpException();
}

$BaseInfo = $app['eccube.repository.base_info']->get();

$activateUrl = $app->url('entry_activate', array('secret_key' => $Customer->getSecretKey()));

// メール送信
$app['eccube.service.mail']->sendAdminCustomerConfirmMail($Customer, $BaseInfo, $activateUrl);
$app['eccube.service.mail']->sendAdminCustomerConfirmMail($Customer, $activateUrl);

$app->addSuccess('admin.customer.resend.complete', 'admin');

Expand Down
7 changes: 7 additions & 0 deletions src/Eccube/Controller/Admin/Order/MailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ public function index(Application $app, Request $request, $id)
$data = $form->getData();
$body = $this->createBody($app, $data['header'], $data['footer'], $Order);

$MailTemplate = $form->get('template')->getData();

$form = $builder->getForm();
$form->setData($data);
$form->get('template')->setData($MailTemplate);


return $app->renderView('Order/mail_confirm.twig', array(
'form' => $form->createView(),
Expand Down Expand Up @@ -192,8 +196,11 @@ public function mailAll(Application $app, Request $request)

$body = $this->createBody($app, $data['header'], $data['footer'], $Order);

$MailTemplate = $form->get('template')->getData();

$form = $builder->getForm();
$form->setData($data);
$form->get('template')->setData($MailTemplate);

return $app->renderView('Order/mail_all_confirm.twig', array(
'form' => $form->createView(),
Expand Down
4 changes: 1 addition & 3 deletions src/Eccube/Controller/Mypage/WithdrawController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ public function index(Application $app, Request $request)

$app['orm.em']->flush();

$BaseInfo = $app['eccube.repository.base_info']->get();

// メール送信
$app['eccube.service.mail']->sendCustomerWithdrawMail($Customer, $BaseInfo, $email);
$app['eccube.service.mail']->sendCustomerWithdrawMail($Customer, $email);

// ログアウト
$this->getSecurity($app)->setToken(null);
Expand Down
1 change: 1 addition & 0 deletions src/Eccube/Resource/config/constant.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,4 @@ admin_product_stock_status: 3
enabled: 1
disabled: 0
eccube_info_url: 'https://www.ec-cube.net/info/3/'
customer_reset_expire: 10
2 changes: 1 addition & 1 deletion src/Eccube/Resource/template/default/Mail/forgot_mail.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

パスワードを変更するには下記URLにアクセスしてください。
※入力されたお客様の情報はSSL暗号化通信により保護されます。
※URLの有効期限は{{ app.config.customer_reset_expire }}分以内です。{{ app.config.customer_reset_expire }}時間を過ぎますとURLは無効となりますので、その場合、もう一度最初から手続きを行ってください。
※URLの有効期限は{{ app.config.customer_reset_expire }}分以内です。有効期限を過ぎますとURLは無効となりますので、その場合、もう一度最初から手続きを行ってください。

{{ reset_url }}

Expand Down
99 changes: 56 additions & 43 deletions src/Eccube/Service/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ class MailService
/** @var \Eccube\Application */
public $app;


/** @var \Eccube\Entity\BaseInfo */
public $BaseInfo;

public function __construct(Application $app)
{
$this->app = $app;
$this->BaseInfo = $app['eccube.repository.base_info']->get();
}


Expand All @@ -51,10 +56,12 @@ public function sendCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $acti
));

$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] 会員登録のご確認')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($Customer->getEmail()))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);
Expand All @@ -75,13 +82,16 @@ public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer)
));

$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] 会員登録が完了しました。')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録が完了しました。')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($Customer->getEmail()))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);

}


Expand All @@ -90,22 +100,23 @@ public function sendCustomerCompleteMail(\Eccube\Entity\Customer $Customer)
* Send withdraw mail.
*
* @param $Customer 会員情報
* @param $BaseInfo baseinfo
* @param $email 会員email
*/
public function sendCustomerWithdrawMail(\Eccube\Entity\Customer $Customer, \Eccube\Entity\BaseInfo $BaseInfo, $email)
public function sendCustomerWithdrawMail(\Eccube\Entity\Customer $Customer, $email)
{

$body = $this->app->renderView('Mail/customer_withdraw_mail.twig', array(
'Customer' => $Customer,
'BaseInfo' => $BaseInfo,
'BaseInfo' => $this->BaseInfo,
));

$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] 退会手続きのご完了')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] 退会手続きのご完了')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($email))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);
Expand All @@ -123,19 +134,12 @@ public function sendrContactMail($formData)

// 問い合わせ者にメール送信
$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] お問い合わせを受け付けました。')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] お問い合わせを受け付けました。')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($formData['email']))
->setBcc($this->app['config']['mail_cc'])
->setBody($formData['contents']);

$this->app->mail($message);

// 管理者へメール送信
$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] お問い合わせがあります。')
->setFrom(array('[email protected]'))
->setTo($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($formData['contents']);

$this->app->mail($message);
Expand All @@ -156,10 +160,12 @@ public function sendOrderMail(\Eccube\Entity\Order $Order)
));

$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] 購入が完了しました。')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] 購入が完了しました。')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($Order->getEmail()))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);
Expand All @@ -171,10 +177,9 @@ public function sendOrderMail(\Eccube\Entity\Order $Order)
* Send admin customer confirm mail.
*
* @param $Customer 会員情報
* @param $BaseInfo baseinfo
* @param $activateUrl アクティベート用url
*/
public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer, \Eccube\Entity\BaseInfo $BaseInfo, $activateUrl)
public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer, $activateUrl)
{

$body = $this->app->renderView('Mail/entry_confirm.twig', array(
Expand All @@ -183,12 +188,12 @@ public function sendAdminCustomerConfirmMail(\Eccube\Entity\Customer $Customer,
));

$message = \Swift_Message::newInstance()
->setSubject('会員登録のご確認')
->setFrom(array($BaseInfo->getEmail03() => $BaseInfo->getShopName()))
->setSubject('[' . $this->BaseInfo->getShopName() . '] 会員登録のご確認')
->setFrom(array($this->BaseInfo->getEmail03() => $this->BaseInfo->getShopName()))
->setTo(array($Customer->getEmail()))
->setBcc($BaseInfo->getEmail01())
->setReplyTo($BaseInfo->getEmail03())
->setReturnPath($BaseInfo->getEmail04())
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);
Expand All @@ -212,10 +217,12 @@ public function sendAdminOrderMail(\Eccube\Entity\Order $Order, $formData)
));

$message = \Swift_Message::newInstance()
->setSubject($formData['subject'])
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . $formData['subject'])
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($Order->getEmail()))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);
Expand All @@ -235,13 +242,16 @@ public function sendPasswordResetNotificationMail(\Eccube\Entity\Customer $Custo
));

$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] パスワード変更の確認')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更の確認')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($Customer->getEmail()))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);

}

/**
Expand All @@ -257,13 +267,16 @@ public function sendPasswordResetCompleteMail(\Eccube\Entity\Customer $Customer,
));

$message = \Swift_Message::newInstance()
->setSubject('[EC-CUBE3] パスワード変更のお知らせ')
->setFrom(array('[email protected]'))
->setSubject('[' . $this->BaseInfo->getShopName() . '] パスワード変更のお知らせ')
->setFrom(array($this->BaseInfo->getEmail01() => $this->BaseInfo->getShopName()))
->setTo(array($Customer->getEmail()))
->setBcc($this->app['config']['mail_cc'])
->setBcc($this->BaseInfo->getEmail01())
->setReplyTo($this->BaseInfo->getEmail03())
->setReturnPath($this->BaseInfo->getEmail04())
->setBody($body);

$this->app->mail($message);

}


Expand Down

0 comments on commit 9d18506

Please sign in to comment.