dswfyq6201 2014-12-17 09:09
浏览 56
已采纳

如何在Symfony2 Debug工具栏中查看使用AJAX发送的电子邮件?

I've read an article from the Symfony2 Cookbook, called "How to work with emails during development", specifically "Viewing from the web debug toolbar". It said that if an email is send and request than redirected, you can still view sent email with 'intercept_redirect' option. However, there is no information regarding how to view an email that was sent with AJAX request...

I believe that such function was implemented in 2.6, according to this article. But most of my project using 2.3, and currently I'm using dirty things like dumping content in response to view it on Network tab in browser toolbar, but that's quite bad for testing purposes.

I've read solutions like this one, but there is still no info about emails.

Maybe anyone had a similar issue? Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongma0722 2014-12-17 10:57
    关注

    The only thing you actually need is having access to debug tokens for your AJAX requests, so you could then open up the profiler and look at the mailer stats. The easiest way to do this would be:

    $(document).ajaxComplete(function(event, XMLHttpRequest, ajaxOption) {
      if (XMLHttpRequest.getResponseHeader('x-debug-token-link')) {
        // This is the link to debug panel
        console.log(XMLHttpRequest.getResponseHeader('x-debug-token-link')); 
      }
    });
    

    This would log all the profiler links to the console. So, after an XMLHttpRequest has completed you could open them up and see whether your emails were sent.

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

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划