Hi there,
What handles those emails? Which plugin or theme?
Marc.
Hi Marc,
You’re fast 🙂
The mails are created by a self written function which is there for many years already.
Okay. Actually the notices aren’t E_notices or errors. They’re debugging information which should be in an html comment.
E.g. <!-- WP Optimize page cache - https://getwpo.com - The request method was not GET (POST) -->
WP_DEBUG
has to be set to true in order for this to happen.
Also this behaviour hasn’t change recently.
Marc.
So to make it clear:
How to suppress these E-notices?
Removing WP_DEBUG
or setting it to false
should stop this.
That’s what i thought, but wp-config.php clearly states : define(‘WP_DEBUG’, false);
If i look at the source of the mail i see :
<html><body style=”font-family: ‘Calibri Light’,Helvetica,Arial,sans-serif;”>The request method was not GET (POST), WordPress login cookies were detected, In the settings, caching is disabled for matches for the current URL<br />
nothing like : <!– WP Optimize page cache
The phrase “caching is disabled for matches for the current URL” is true, i did disable it to see if this problem occured from wp-optimize, which it looks like.
I rather not deactivate wp-optimize as it’s otherwise working very good.
When i disable page caching the problem is gone, enabling it returns.
Any thoughts on what to try next?
hmm…
Would it be possible for you to share the code you use for your form?
You could submit it using this form if you don’t want to share it publicly here.
Thanks, I’ve send the code via the form.
Found it!
In the current php version (7.3.18) this construct is causing this odd behaviour:
e.g. $to .= “mailaddress@mail.com”
Should now be $to = “mailaddress@mail.com”
If the variable $to is not defined before $to .= gives unexpected odd results.
Sorry for consuming your time, but maybe this will help others.
Truly similar issue, but a different solution.
In my case, custom code meant that the E-Notice was replacing the $message, not the $to field. So, the recipients were getting the notice instead of the message body.
I’ve looked back in this support forum and see that issues related to this have come up from time to time, and I’d like to suggest you implement a different solution.
//in file: file-based-page-cache.php
//DEV TEAM - Please Consider Allowing Users to Toggle This setting
//MY HACK
$no_cache_because='';
if (!empty($no_cache_because)) {
$message = implode(', ', $no_cache_because);
// Add http header
if (!defined('DOING_CRON') || !DOING_CRON) {
wpo_cache_add_nocache_http_header($message);
}
// Only output if the user has turned on debugging output
if (((defined('WP_DEBUG') && WP_DEBUG) || isset($_GET['wpo_cache_debug'])) && (!defined('DOING_CRON') || !DOING_CRON)) {
wpo_cache_add_footer_output("Page not served from cache because: ".htmlspecialchars($message));
}
return;
}
Instead of chasing down each instance that causes an issue with your design decision to insert comments into the HTML, please consider allowing users to turn it off completely — even if you choose to hide the toggle in the ADVANCED Section.
Here are the relevant lines in my custom code:
// Load WP components, no themes.
define('WP_USE_THEMES', false);
require_once('/home3/xxx/public_html/XXXXX.com/wp-load.php');
// send test message using wp_mail function.
$sent_message = wp_mail( $to, $subject, $message, $headers, $attachments );
Typically, something like this would be run as a Cron Job, but since it is not in my case, your DOING_CRON exception does not apply.
This is why I’d really like a toggle added.
-
This reply was modified 5 years ago by
Steven Jay Cohen. Reason: anonymizing code