Page 1 of 2
New User Email Messages Not Sending
Posted:
September 10th, 2011, 6:08 pm
by dskallman
Hi,
I started using the Custom New User Registration Emails and they are not going out, no matter if it is the New User email or the Payment confirmation email. Have you seen this issue before? The user gets registered when using Pro Forms and then I redirect to payment, but no confirmations go out to the user. If I do forgot password then they can access, but how can I ensure the new user registration goes out?
Thanks!
Dana
Re: New User Email Messages Not Sending
Posted:
September 11th, 2011, 10:44 am
by dskallman
I just tested it putting the Email Configuration back to WordPress Defaults and the email gets sent with username and password. Any thoughts on why this may be?
Re: New User Email Messages Not Sending
Posted:
September 14th, 2011, 2:11 am
by Cristián Lávaque
What are the differences between the WP defaults and what you had with the problem?
Re: New User Email Messages Not Sending
Posted:
September 14th, 2011, 7:15 am
by dskallman
It was a longer, personalized message that has more detail about the site and includes the username & password at the end of the message. Does that make a difference?
Re: New User Email Messages Not Sending
Posted:
September 26th, 2011, 11:57 pm
by Cristián Lávaque
Thanks. I emailed Jason about it, in case it's a bug.
Re: New User Email Messages Not Sending
Posted:
September 27th, 2011, 8:03 pm
by Jason Caldwell
Hi Dana. A few tweaks later, please try this again in s2Member v110927+ and let me know your results. We found some issues related to BuddyPress v1.5 that were corrected, and some other minor tweaks took place as well. If you can test in the latest release please, that way we're on the same page here.
Re: New User Email Messages Not Sending
Posted:
September 28th, 2011, 9:01 am
by dskallman
Hey Jason,
I just tested it and I had no email. I only got the administrator notice saying there is a new user, but not the custom email with the username and password. Any thoughts?
Thanks!
Dana
Re: New User Email Messages Not Sending
Posted:
September 30th, 2011, 1:41 pm
by leoquijano
Hi, I'm having the same problem. I'm using Standard, not Pro, and i'm not getting any e-mails when setting the options to the customized
new registrations.
I managed to track the problem down - for
new registrations, I haven't tested payment confirmations - to this line in classes/
email-configs.inc.php:
email-configs.inc.php(line 238):
- Code: Select all
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ([b]'"' . c_ws_plugin__s2member_utils_strings::esc_dq ($user_full_name) . '" <' . $user->user_email . '>'[/b], $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
By replacing the "to" parameter of the wp_mail function to just the e-mail address, the
email gets
sent:
- Code: Select all
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ([b]$user->user_email[/b], $sbj, $msg, "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
So the problem, at least for me, it's s2member trying to send
email to
"John Doe" <john_doe@gmail.com>
, instead of just sending to
john_doe@gmail.com
.
I'm using Windows IIS and s2member 110927.
Thoughts?
Re: New User Email Messages Not Sending
Posted:
October 3rd, 2011, 7:10 pm
by Jason Caldwell
Thanks for reporting this important issue.
I've been unable to reproduce this so far, but I see what you're describing. Can you please tell me what other plugins that you're running on this installation? Any other plugin that works to supplement the core wp_mail() function in some way?
"John Doe" <john_doe@gmail.com> is a valid recipient address, so I'd like to find the underlying cause as opposed to reducing the recipient down to just the email address.
Re: New User Email Messages Not Sending
Posted:
October 3rd, 2011, 9:53 pm
by s_d_p
I had this problem with a smtp_mail plugin. It mostly just provides a menu to configure smpt mail settings, but perhaps it overrides some things. I also used mailpress, but removed it to test and the problem persisted.
Re: New User Email Messages Not Sending
Posted:
October 3rd, 2011, 10:02 pm
by Jason Caldwell
Thank you. I'll test against that plugin.
Is this it?
http://wordpress.org/extend/plugins/wp-mail-smtp/
Re: New User Email Messages Not Sending
Posted:
October 3rd, 2011, 10:11 pm
by leoquijano
I'm also debugging. I narrowed it down to this MailEnable SMTP log entry:
RCPT TO:<My Name <my@email_address.com> 501 Invalid Address 52 21
I changed my name and my email, but notice that an additional, unclosed, "<" was added.
I'm now trying to figure out if it's a problem with my SMTP config, or if some plugin is interfering with the mail() call.
Re: New User Email Messages Not Sending
Posted:
October 3rd, 2011, 10:47 pm
by leoquijano
Got it !!!
Ok, for the record, I'm using PHP 5.2.6 in a Windows box. This version of PHP has a known bug in the
mail() implementation:
https://bugs.php.net/bug.php?id=28038The bug was fixed in 5.2.11 and in 5.3.x branches.
Though actually, if you read the discussion there, they treat it as a workaround and not a bug fix. According to RFC2821, the RCPT TO field in an e-mail message must be e-mail only:
http://tools.ietf.org/html/rfc2821#section-6The bug patch includes a patch for PHP that prevents the mail() call (which is used by PHPMailer, which in turn is used by Wordpress, which is used by s2Member) from enveloping the address with "<" and ">".
Anyone with a Windows box (pre-5.2.11) to confirm? Maybe a workaround is in order?
I think I can workaround it with the "wp_mail" filter, but this might bug other Windows users with older PHP versions (lower PHP 5.2 versions are still very common I think)
Re: New User Email Messages Not Sending
Posted:
October 3rd, 2011, 11:36 pm
by leoquijano
btw, if someone's having the same problem, here's my workaround (Windows, PHP < 5.2.11):
- Code: Select all
add_filter("wp_mail", "filter_wp_mail");
function filter_wp_mail($vars) {
$vars["to"] = preg_replace("/.*<(.*)>.*/i", "$1", $vars["to"]);
return $vars;
}
By the way,
Jason, do you think it would be feasible to provide a s2member specific configuration for the content-type? Right now this is fixed as "text/plain" in
email-configs.inc.php, but it would be nice to be able to use HTML content (even select it from the plugin admin page).
I know I can filter it using "wp_mail_content_type", but that filters ALL
email generated from Wordpress, including
email from random plugins. So, as a suggestion, adding that capability to s2member would be nice.
Re: New User Email Messages Not Sending
Posted:
October 4th, 2011, 11:49 am
by ryannagy
I am having a similar problem. I am manually adding several members. The members get added but I get an error message: "Internal Server Error.The server encountered an internal error or misconfiguration and was unable to complete your request."
At first the welcome emails were not sent. But then I deleted the plugin New User Email Setup By Alex Cragg in favor of S2Members built-in functionality. However, I am still getting the error message above. Though notification emails appear to be getting through.
Thoughts? I have got multiple affiliates sending out mass emails soon and would like to figure out what is going on ASAP. This is my first set-up using MediaTemple hosting. Perhaps I neglected to do something.
Re: New User Email Messages Not Sending
Posted:
October 7th, 2011, 7:44 pm
by Jason Caldwell
Awesome work on this.
Thanks for letting me know about this bug in some versions of PHP.leoquijano wrote:Got it !!!
Ok, for the record, I'm using PHP 5.2.6 in a Windows box. This version of PHP has a known bug in the
mail() implementation:
https://bugs.php.net/bug.php?id=28038The bug was fixed in 5.2.11 and in 5.3.x branches.
Though actually, if you read the discussion there, they treat it as a workaround and not a bug fix. According to RFC2821, the RCPT TO field in an e-mail message must be e-mail only:
http://tools.ietf.org/html/rfc2821#section-6
OK, I'm taking a closer look at this now and I'll post an update once we have a good handle on how we're going to work around this issue. In the mean time, your hack looks like a good temporary solution. Watch out for array values though. The
wp_mail() function accepts both a string and/or an array of strings in the
to variable. See:
http://codex.wordpress.org/Function_Reference/wp_mail- Code: Select all
add_filter("wp_mail", "filter_wp_mail");
function filter_wp_mail($vars) {
$vars["to"] = preg_replace("/.*<(.*)>.*/i", "$1", $vars["to"]);
return $vars;
}
Re: New User Email Messages Not Sending
Posted:
October 7th, 2011, 7:52 pm
by Jason Caldwell
I've seen this reported in the past. I believe that some of the grid servers at MediaTemple have an issue with the wp_mail() function. Not all, just some of them, for whatever reason. Or, more specifically, with the PHPMailer class, which is what wp_mail() relies on. This issue has just come to my attention recently, and until MT gets this fixed, you might try HostGator instead, or ask MediaTemple to investigate this further for you, and/or move you to a different cluster.
I'm not exactly sure what the bug is, by I've seen this happen on a client's site recently, where all calls to wp_mail() resulted in a 503 server error on MediaTemple (gs), and all we got was an error in the Apache log about a premature end of script headers
( which is nothing to go on ). I ran the same code on another client's site, from a different MT cluster/node, and the bug did not exist. Just to be certain, we're going to go back through and run some additional tests against the PHP 5.2.x bug reported above, just to rule that out. However, I believe at this point that these two issues are unrelated.
ryannagy wrote:I am having a similar problem. I am manually adding several members. The members get added but I get an error message: "Internal Server Error.The server encountered an internal error or misconfiguration and was unable to complete your request."
At first the welcome emails were not sent. But then I deleted the plugin New User Email Setup By Alex Cragg in favor of S2Members built-in functionality. However, I am still getting the error message above. Though notification emails appear to be getting through.
Thoughts? I have got multiple affiliates sending out mass emails soon and would like to figure out what is going on ASAP. This is my first set-up using MediaTemple hosting. Perhaps I neglected to do something.
Re: New User Email Messages Not Sending
Posted:
October 7th, 2011, 7:53 pm
by leoquijano
You're right, but preg_replace supports arrays as the subject =)
http://www.php.net/manual/en/function.preg-replace.phpsubject
The string or an array with strings to search and replace.
If subject is an array, then the search and replace is performed on every entry of subject, and the return value is an array as well.
glad the issue report helped
Re: New User Email Messages Not Sending
Posted:
October 8th, 2011, 3:05 pm
by Jason Caldwell
Oh, very good then. Nice work and yes, thanks for the bug report on this.
Re: New User Email Messages Not Sending
Posted:
October 9th, 2011, 7:27 pm
by Jason Caldwell
Confirmed. This is fixed in the development copy of s2Member, coming soon in public release. I'll go ahead and post the utility routine we used to maximize compatibility in this regard, just in case you'd like to review and let us know if we missed anything. Thanks again!
WordPress wp_mail() Filter:
- Code: Select all
public static function email_filter ($array = FALSE)
{
if (isset ($array["to"]) && !empty ($array["to"])) $array["to"] = implode (",", c_ws_plugin__s2member_utils_strings::parse_emails ($array["to"]));
return apply_filters ("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
}
Utility routine:
- Code: Select all
public static function parse_emails ($value = FALSE)
{
if (is_array ($value)) {
$emails = array (); foreach ($value as $_value) $emails = array_merge ($emails, c_ws_plugin__s2member_utils_strings::parse_emails ($_value));
return $emails; }
$delimiter = (strpos ((string)$value, ";") !== false) ? ";" : ",";
foreach (($sections = c_ws_plugin__s2member_utils_strings::trim_deep (preg_split ("/" . preg_quote ($delimiter, "/") . "+/", (string)$value))) as $section)
{
if (preg_match ("/\<(.+?)\>/", $section, $m) && strpos ($m[1], "@") !== false)
$emails[] = $m[1]; else if (strpos ($section, "@") !== false)
$emails[] = $section;
}
return (!empty ($emails)) ? $emails : array ();
}
Re: New User Email Messages Not Sending
Posted:
October 20th, 2011, 4:11 pm
by Jason Caldwell
s2Member v111017+ should completely resolve the issue reported here.
~ Thanks for the great feedback.
Re: New User Email Messages Not Sending
Posted:
October 21st, 2011, 1:22 am
by leoquijano
Hi Jason,
Thanks for the update! I'm coming back to that project very soon, so I'll take a look from my side and verify everything's working good.
Re: New User Email Messages Not Sending
Posted:
October 21st, 2011, 12:13 pm
by leoquijano
Allright: tested it without my workaround -> working fine! thanks!
Re: New User Email Messages Not Sending
Posted:
October 21st, 2011, 1:15 pm
by bertranddory
I am running 111017, and I still have the same issue!
Can somebody help me here, as this is stopping my affiliate programme, and Click*Bank are looking to withdraw my product.
This is why I bought Pro, so I need some help here!
Thannkd
Re: New User Email Messages Not Sending
Posted:
October 21st, 2011, 5:10 pm
by Jason Caldwell
For anyone else still having trouble with mail, please see this important post:
viewtopic.php?f=4&t=15555&p=48533#p48533Also, please remember that emails will NOT be processed by s2Member if your Payment Gateway integration is incomplete in some way. It's always a good idea to enable s2Member's Logging/Debugging routines so you can see the communication that occurs behind-the-scene. s2Member's log files will tell you when, and to whom,
email messages were
sent to. For instance, with PayPal, check your Dashboard here:
s2Member -> PayPal Options -> Account Details -> Logging/Debugging