私の開発環境では、電子メールを受け取るためにmailhogを使用したいと思います。私はsendmailプロパティを維持するためにphp.iniをインストールして設定しました。コマンドラインで、私はこのSymfony 3とMailhog:メールがメールボックスでキャッシュされていない
php -r "mail(......);"
を実行する場合 メールはmailhogで撮影します。問題はSymfonyとSwiftmailerの問題です。テストを行うために、これを使って非常に単純なコントローラを作成しました:
/**
* @return Response
*/
public function homeAction() : Response
{
mail('[email protected]', 'tasest', 'aaaa');
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody(
'aaaaa',
'text/html'
);
$this->get('mailer')->send($message);
return $this->render('::base.html.twig');
}
今、メール関数によって送信された電子メールは、メールハードによって取り込まれます。しかしSwiftMailerから送られたメールはありません。私は十分なはずだと思う
# Swiftmailer Configuration
swiftmailer:
transport: "sendmail"
:私のconfig_devで
私はこれを持っています。
ここに何か不足していますか?
PS:
:私もparameters.yml、SMTPのmailhogを設定しようとした :私は(代わりに [email protected]の)実アドレスを使用している場合、メールが送信され、更新を受けます
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_port: 1025
mailer_user: null
mailer_password: null
config.yml:
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
port: "%mailer_port%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
しかし、結果は同じ結果でした。
問題を解決しました。キャッシュの問題 – petekaner