Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending emails manually error out with white screen (but still sends) #5

Open
lonkelle opened this issue Feb 27, 2016 · 4 comments
Open
Labels

Comments

@lonkelle
Copy link

I'll use WooCommerce as an example - if I go to any given order, and try to resend order emails (specifically, in my testing, I used WooCommerce Subscription renewal notices), the plugin sends the email, BUT - it errors out, simply printing the email it sent to, but everything else is a white screen as WP crashes, here's the output:

array(1) { [0]=> string(18) "[email protected]" }

If debug mode is on, then it prints this:

Warning: array_merge(): Argument #2 is not an array in /wp-content/plugins/aws-ses-wp-mail/inc/class-ses.php on line 76
and then echoes out the array:
array(1) { [0]=> string(18) "[email protected]" }

@lonkelle lonkelle changed the title Sending WooCommerce emails manually error out with white screen (but still send) Sending WooCommerce emails manually error out with white screen (but still sends) Feb 27, 2016
@lonkelle
Copy link
Author

So, my solution to this was to:

ob_start();

at the beginning of the entire plugin (but I'm guessing I could put it at the beginning of the send_wp_mail function, I was just doing this quickly), and then:

ob_end_clean();

at the end of the send_wp_mail() function.

I'm guessing you guys may not have noticed it because you have output buffering ALWAYS on by default, but since some don't - these pieces of code are important.

I never did figure out WHERE the output was coming from since buffering the output was the easiest solution at the time (but removing that output would also fix this issue).

@lonkelle lonkelle changed the title Sending WooCommerce emails manually error out with white screen (but still sends) Sending emails manually error out with white screen (but still sends) Feb 27, 2016
@rmccue rmccue added the bug label Feb 28, 2016
@rmccue
Copy link
Member

rmccue commented Feb 28, 2016

I see a bug here with $headers not correctly being used if it's a string; not sure where that output is though, but doesn't appear to be in the plugin itself.

@lonkelle
Copy link
Author

I couldn't find why it was outputting the array since I just dove into the output buffer fix.

But, there are no problems if I deactivate the plugin and there are no problems if I code the output buffer to catch anything the plugin outputs in that function. Maybe the fact that it's a string is what causes the output (for whatever reason)?

@roborourke
Copy link
Contributor

@JoelStickney @rmccue #10 should help, I found that the content type was broken too causing newlines etc to be stripped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants