symfony email发送求助
大家好。小女子初学symfony。其中的email功能一直不行哦。
代码用的是最简单的:
$this->getMailer()->composeAndSend(
'from@example.com',
'fabien@example.com',
'Subject',
'Body'
);
factories.yml配置:
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_MailTransport
param:
host: localhost
port: 25
encryption: ~
username: ~
password: ~
因为公司的邮箱禁掉了smtp,所以改成了Swift_MailTransport。
这样在开发环境下可以在调试中看到邮件,但是delivery_strategy是none。邮箱没有收到邮件。
在实际环境中,也没有收到发送的邮件。
后来换成了gmail的,虽然没有报错,但也没有收到邮件。
怎么才能收到邮件呢?
在线等~~