dongshi1102 2015-04-01 21:59
浏览 21
已采纳

Symfony 1.4动态/编程为swiftmailer设置delivery_strategy

So I am working on Symfony 1.4 and I am looking for a way to programmatically set a different delivery_strategy than what I have in my factories.yml.

My code for initialising the mailer and the transport is as below:

$transport  = Swift_SmtpTransport::newInstance('MY SMTP SERVER');
$transport->setUsername($api_user);        
$transport->setPassword($api_key);        
$swift      = Swift_Mailer::newInstance($transport);                        
$response   = $swift->send($message);

For example in my factories.yml I have the strategy set to spool but here I want to set it to realtime.

Any way of doing this programmatically?

  • 写回答

1条回答 默认 最新

  • dounaoji2054 2015-04-04 23:34
    关注

    Real-time means it'll be sent right away. So the code you're already using should do that. The documentation link have more info swiftmailer.org/docs/sending.html.

    Delivery strategy is a Symfony concept. Swiftmailer does not have it. All you send using Swiftmailer directly will be sent right away, corresponding to the Symfony 'realtime' delivery strategy.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog