admin管理员组文章数量:1299977
When I try to send more than one email message in the same request, only de 1st message is sent, the rest of the messages are blocked with the error "Message body empty".
The following code should send 4 different emails, each one with different subject and message, but only the first one is sent:
$to = "[email protected]";
$subject = "Mail test ";
$message = "This is the body ";
wp_mail($to, $subject . "1", $message . "1"); // Sent
wp_mail($to, $subject . "2", $message . "2"); // Not sent (Message body empty)
wp_mail($to, $subject . "3", $message . "3"); // Not sent (Message body empty)
wp_mail($to, $subject . "4", $message . "4"); // Not sent (Message body empty)
I'm using WordPress 5.6.2 and WP Mail SMTP 2.6.0
Edit: (Solved) I checked the other plugins and the issue was caused by an outdated "Email Templates" plugin. Once I updated it to the last version, I started receiving all the messages.
When I try to send more than one email message in the same request, only de 1st message is sent, the rest of the messages are blocked with the error "Message body empty".
The following code should send 4 different emails, each one with different subject and message, but only the first one is sent:
$to = "[email protected]";
$subject = "Mail test ";
$message = "This is the body ";
wp_mail($to, $subject . "1", $message . "1"); // Sent
wp_mail($to, $subject . "2", $message . "2"); // Not sent (Message body empty)
wp_mail($to, $subject . "3", $message . "3"); // Not sent (Message body empty)
wp_mail($to, $subject . "4", $message . "4"); // Not sent (Message body empty)
I'm using WordPress 5.6.2 and WP Mail SMTP 2.6.0
Edit: (Solved) I checked the other plugins and the issue was caused by an outdated "Email Templates" plugin. Once I updated it to the last version, I started receiving all the messages.
Share Improve this question edited Mar 25, 2021 at 14:08 juankvillegas asked Mar 25, 2021 at 11:03 juankvillegasjuankvillegas 973 bronze badges 6- Your exact code works fine for me. Have you actually tested with this code? Or do you just have similar code that doesn't work? – Jacob Peattie Commented Mar 25, 2021 at 11:52
- I tested this exact code before to post it here. Do you use WP Mail SMTP? – juankvillegas Commented Mar 25, 2021 at 12:30
- No. So if it works without the plugin then the issue is the plugin, or your configuration of it. Since third party plugins are off topic here, you'll need to speak with its author. – Jacob Peattie Commented Mar 25, 2021 at 12:34
- I added the same question in the plugin's support page: wordpress/support/topic/… – juankvillegas Commented Mar 25, 2021 at 13:01
- 2 @juankvillegas please post the solution as a solution, don't edit it into your question. Remember this is a Question Anser site not a discussion forum thread, you need to post the answer using the big box underneath – Tom J Nowell ♦ Commented Mar 25, 2021 at 14:13
1 Answer
Reset to default 0The issue was not caused by WordPress. It was caused by a plugin.
In this particular case, I checked the plugins installed looking for anything that could modify the mail behavior. I disabled the plugin "Email Templates" and started receiving all the messages normally. Then I noted that there was an update available for that plugin, I applied the update, tested again and it was working as expected.
So, in summary, the issue was caused by an outdated plugin.
本文标签: errorsWordPress is not sending the 2nd email in the same request
版权声明:本文标题:errors - WordPress is not sending the 2nd email in the same request 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741654508a2390677.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论