<?php
/* This file is part of EC-CUBE
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Eccube\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class MailCommand extends Command
{
protected static $defaultName = 'eccube:mail';
/** * @var SymfonyStyle */ protected $io; public function __construct(\Swift_Mailer $mailer) { parent::__construct(); $this->mailer = $mailer; }protected function configure() { $this->setDescription('メールのテスト'); }protected function initialize(InputInterface $input, OutputInterface $output) { $this->io = new SymfonyStyle($input, $output); }protected function execute(InputInterface $input, OutputInterface $output) { $message = (new \Swift_Message()) ->setSubject('メール送信チェック') ->setFrom('test01@example.com') ->setTo('test02@example.com') ->setBcc('test03@example.com') ->setReplyTo('test04@example.com') ->setReturnPath('test05@example.com'); $this->mailer->send($message); $this->io->success('メール送信テスト完了.'); }
}