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 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真