PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

New User Email Messages Not Sending

s2Member Plugin. A Membership plugin for WordPress®.

New User Email Messages Not Sending

Postby dskallman » September 10th, 2011, 6:08 pm

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
User avatar
dskallman
Registered User
Registered User
 
Posts: 68
Joined: October 18, 2010

Re: New User Email Messages Not Sending

Postby dskallman » September 11th, 2011, 10:44 am

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?
User avatar
dskallman
Registered User
Registered User
 
Posts: 68
Joined: October 18, 2010

Re: New User Email Messages Not Sending

Postby Cristián Lávaque » September 14th, 2011, 2:11 am

What are the differences between the WP defaults and what you had with the problem?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: New User Email Messages Not Sending

Postby dskallman » September 14th, 2011, 7:15 am

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?
User avatar
dskallman
Registered User
Registered User
 
Posts: 68
Joined: October 18, 2010

Re: New User Email Messages Not Sending

Postby Cristián Lávaque » September 26th, 2011, 11:57 pm

Thanks. I emailed Jason about it, in case it's a bug.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: New User Email Messages Not Sending

Postby Jason Caldwell » September 27th, 2011, 8:03 pm

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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby dskallman » September 28th, 2011, 9:01 am

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
User avatar
dskallman
Registered User
Registered User
 
Posts: 68
Joined: October 18, 2010

Re: New User Email Messages Not Sending

Postby leoquijano » September 30th, 2011, 1:41 pm

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?
Last edited by Cristián Lávaque on October 2nd, 2011, 1:40 am, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 3rd, 2011, 7:10 pm

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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby s_d_p » October 3rd, 2011, 9:53 pm

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.
User avatar
s_d_p
Registered User
Registered User
 
Posts: 23
Joined: July 26, 2011

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 3rd, 2011, 10:02 pm

Thank you. I'll test against that plugin.
Is this it? http://wordpress.org/extend/plugins/wp-mail-smtp/
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby leoquijano » October 3rd, 2011, 10:11 pm

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.
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby leoquijano » October 3rd, 2011, 10:47 pm

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=28038

The 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

The 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)
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby leoquijano » October 3rd, 2011, 11:36 pm

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.
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby ryannagy » October 4th, 2011, 11:49 am

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.
User avatar
ryannagy
Registered User
Registered User
 
Posts: 68
Joined: May 18, 2010

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 7th, 2011, 7:44 pm

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=28038

The 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"] = /* Could be an array here. */ preg_replace("/.*<(.*)>.*/i", "$1", $vars["to"]);
  return $vars;
}
 
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 7th, 2011, 7:52 pm

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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby leoquijano » October 7th, 2011, 7:53 pm

You're right, but preg_replace supports arrays as the subject =)

http://www.php.net/manual/en/function.preg-replace.php

subject
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
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 8th, 2011, 3:05 pm

Oh, very good then. Nice work and yes, thanks for the bug report on this.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 9th, 2011, 7:27 pm

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
/**
* Filters email addresses passed to ``wp_mail()``.
*
* @package s2Member\Email_Configs
* @since 3.5
*
* @attaches-to ``add_filter("wp_mail");``
* @uses {@link s2Member\Utilities\c_ws_plugin__s2member_utils_strings::parse_emails()}
*
* @param array $array Expects an array passed through by the Filter.
* @return array Returns the array passed through by the Filter.
*/
public static function email_filter ($array = FALSE)
    {
        if (isset ($array["to"]) && !empty ($array["to"])) /* Filter list of recipients? */
            /* Reduces `"Name" <email>`, to just an email address *(for best cross-platform compatibility across various MTAs)*. */
            /* Also works around bug in PHP versions prior to fix in 5.2.11. See bug report: <https://bugs.php.net/bug.php?id=28038>. */
            /* Also supplements WordPress®. WordPress® currently does NOT support semicolon `;` delimitation, s2Member does. */
            $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
/**
* Parses email addresses from a string or array.
*
* @package s2Member\Utilities
* @since 111009
*
* @param str|array $value Input string or an array is also fine.
* @return array Array of parsed email addresses.
*/
public static function parse_emails ($value = FALSE)
    {
        if (is_array ($value)) /* Handles all types of arrays.
        Note, we do NOT use ``array_map()`` here, because multiple args to ``array_map()`` causes a loss of string keys.
        For further details, see: <http://php.net/manual/en/function.array-map.php>. */
            {
                $emails = array (); /* Initialize array of emails. */
                foreach ($value as $_value) /* Loop through array. */
                    $emails = array_merge ($emails, c_ws_plugin__s2member_utils_strings::parse_emails ($_value));
                return $emails; /* Return array of parsed email addresses. */
            }
        /**/
        $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]; /* Email inside brackets. */
                /**/
                else if (strpos ($section, "@") !== false)
                    $emails[] = $section;
            }
        /**/
        return (!empty ($emails)) ? $emails : array ();
    } 
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 20th, 2011, 4:11 pm

s2Member v111017+ should completely resolve the issue reported here.
~ Thanks for the great feedback.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: New User Email Messages Not Sending

Postby leoquijano » October 21st, 2011, 1:22 am

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.
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby leoquijano » October 21st, 2011, 12:13 pm

Allright: tested it without my workaround -> working fine! thanks!
User avatar
leoquijano
Registered User
Registered User
 
Posts: 7
Joined: September 30, 2011

Re: New User Email Messages Not Sending

Postby bertranddory » October 21st, 2011, 1:15 pm

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
User avatar
bertranddory
Registered User
Registered User
 
Posts: 11
Joined: September 23, 2011

Re: New User Email Messages Not Sending

Postby Jason Caldwell » October 21st, 2011, 5:10 pm

For anyone else still having trouble with mail, please see this important post:
viewtopic.php?f=4&t=15555&p=48533#p48533

Also, 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
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Next

Return to s2Member Plugin

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests

cron