Any update on the Mail-Issue?
-
WPdiscuz doesn’t send Notification E-Mails. Is there a workaround to get it work with WP-Mail-SMTP?
-
Hi caschy,
wpDiscuz doesn’t have a separate email sending system. It use WordPress built-in email functions. I think something is wrong configured on your website if it doesn’t send email.I get the e-mails, but the “From” field is empty and thus is filtered as a spam message. The message header looks like it’s trying to send using the server’s address, not the WordPress settings.
We’re working on this and will make it better. By now you can try this:
Open wpdiscuz/wc.php file, find this code:
$headers[] = "Content-Type: $content_type; charset=UTF-8"; $headers[] = "From: " . $from_name . "\r\n"; wp_mail($email_data['email'], $subject, $message, $headers);and change it to this:
wp_mail($email_data['email'], $subject, $message);That helps. Now it sends from [email protected], instead of the web server’s root. This is a great step in the right direction!
The body of the message, however, now looks like the HTML was ignored and not parsed and is simply listed as text. See the example below. (I replaced any domains and URL ids with mydomain and 999, respectively, to protect the privacy of my clients.
Hi, <br/> You just subscribed for new comments on our website. This means you will receive an email when new comments are posted according to subscription option you've chosen. <br/> To activate, click confirm below. If you believe this is an error, ignore this message and we'll never bother you again.<br/><br/><a href='http://www.mydomain.com/'>http://www.mydomain.com/</a><br/><br/><a href='http://www.mydomain.com/?wpdiscuzConfirmID=999&wpdiscuzConfirmKey=999&wpDiscuzComfirm=yes&#wc_unsubscribe_message'>Confirm your subscription</a><br/><br/><a href='http://www.mydomain.com/?wpdiscuzSubscribeID=999&key=999&#wc_unsubscribe_message'>Ignore Subscription</a>Ok,
Try this:wp_mail($email_data['email'], $subject, $message);change to this:
$content_type = apply_filters('wp_mail_content_type', 'text/html'); $from_name = apply_filters('wp_mail_from_name', get_option( 'blogname')); $from_email = apply_filters('wp_mail_from', get_option('admin_email')); $headers[] = "Content-Type: $content_type; charset=UTF-8"; $headers[] = "From: " . $from_name . " <" . $from_email . "> \r\n"; wp_mail($email_data['email'], $subject, $message, $headers);This doesn’t work. Anytime the code includes the $headers, it sent from “Unknown sender” which is the web hosting root user.
I tried various combinations of using the $headers, they all resulted in the same thing.
However, I DID notice, that when the HTML is displayed properly in the body of the e-mail and the sender is unknown, the message source shows:
Content-Type: text/html; charset=UTF-8
But when the HTML is not parsed correctly, but the sender is correct (using your FIRST instruction above), the message source shows:
Content-Type: text/plain; charset=UTF-8
So, it seems the issue is that we do not want to send our own headers, in order to preserve the sending address, but we want to tell the server to send it as HTML, rather than plain text.
I’m just not familiar enough with PHP or the rest of the plugins code to know how to do this properly….
I’m wrong. Starting on line 991, I tried the following code (based on another plugin’s code) and the message source shows Content-Type: text/html; charset=UTF-8, and the HTML is being parsed properly, but the from address is still reverting back to the server’s root.
$headers = array(); $content_type = apply_filters('wp_mail_content_type', 'text/html'); $from_name = apply_filters('wp_mail_from_name', get_bloginfo('name')); wp_mail($email_data['email'], $subject, $message, $content_type);Just checking in here. Any word on a fix for this?
Hi brandon.w,
This is a site or server specific issue, because wpDiscuz email works fine on our tested websites. The changes mentioned above also work fine.Please try this code:
$from_name = apply_filters('wp_mail_from_name', get_option( 'blogname')); $from_email = apply_filters('wp_mail_from', get_option('admin_email')); $from_email = (trim($from_email)) ? $from_email : '[email protected]'; $content_type = apply_filters('wp_mail_content_type', 'text/html'); $headers[] = "Content-Type: $content_type; charset=UTF-8"; $headers[] = "From: " . $from_name . " <" . $from_email . ">"; wp_mail($email_data['email'], $subject, $message, $headers);Do not forget to change [email protected] email address.
Same thing, the HTML is parsed correctly, but the from line in the e-mail is blank and the from address is the server’s root. 🙁
Ok, this is not wpDiscuz issue for sure. You have some problem with your WP, please try to deactivate all plugins and test it again. Also male sure you’ve set admin email address in WP general settings.
The admin e-mail address is set, but has nothing to do with the from address in subscription notifications from wpDiscuz.
As a test – I deactivated ALL plugins, except for wpDiscuz and got the same results. From line is blank, and the e-mail source is the server’s root.
The only other plugin I use that sends out e-mails uses the Swift Mailer module to send e-mails. I have not experienced this issue with their module…
I take it back, I get notifications from WordFence, too, and their messages always come in from “[email protected]” and their HTML formatted.
WordFence uses this to send e-mail notifications:
wp_mail(implode(',', $emails), $subject, $content, 'Content-type: text/html');Ok, then try to change whole code to this:
wp_mail($email_data['email'], $subject, $message, 'Content-type: text/html; charset=UTF-8');
The topic ‘Any update on the Mail-Issue?’ is closed to new replies.