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.

图片转代码服务由CSDN问答提供 功能建议

我读过Symfony2 Cookbook上的一篇文章,名为“如何在开发过程中处理电子邮件” ,特别是“从Web调试工具栏查看”。 它说如果发送电子邮件和请求而不是重定向,您仍然可以使用'intercept_redirect'选项查看已发送的电子邮件。 但是,没有关于如何查看使用AJAX请求发送的电子邮件的信息...

我相信这样的功能是在 2.6 中实现的,根据 文章。 但是我的大部分项目都是使用 2.3 ,目前我正在使用诸如转储内容之类的脏东西,以便在浏览器工具栏中的 Network 选项卡上查看它,但这对于 测试目的。

我读过像这个,但仍然没有关于电子邮件的信息。

也许有人有类似的问题? 提前致谢。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题