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.
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.