我遇到电子邮件发送问题。没有假脱机我无法发送电子邮件。
在文档中,我只看到$mailer->send();
http://symfony.com/doc/current/email.html
但对我来说,它什么都不做。 要发送电子邮件,我必须这样做:
$mailer->send($message);
$spool = $mailer->getTransport()->getSpool();
$transport = $this->get('swiftmailer.transport.real');
$spool->flushQueue($transport);
ContactType.php
$builder
->add('name', TextType::class, [
'required' => false
])
->add('email', EmailType::class)
->add('message', TextareaType::class);
哪里可能有问题?
答案 0 :(得分:1)
您可以定义一个非假脱机邮件并使用它而不是默认邮件:
https://symfony.com/doc/current/reference/configuration/swiftmailer.html#using-multiple-mailers