У меня есть приложение Symfony, работающее на виртуальной машине Debian 7. Я пытаюсь отправить почту с помощью swiftMailer. Кажется, все хорошо, когда вы запускаете код, но не получено никаких сообщений. Что мне не хватает?Отправка почты с помощью swiftMailer SMTP и Debian
Контроллер:
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody('hello');
$mailer = $this->get('mailer');
if (!$mailer->send($message, $failures)) {
echo "Failures:";
print_r($failures);
return "ko";
} else {
return 'email sent successfully';
}
Это всегда возвращается "Сообщение успешно отправлено".
config.yml:
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
#spool: { type: memory }
parameters.yml:
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
php.ini:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = 127.0.0.1
; http://php.net/smtp-port
smtp_port = 25