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™
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 ();
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 ();
"John Doe" <john_doe@gmail.com>
john_doe@gmail.com
add_filter("wp_mail", "filter_wp_mail");
function filter_wp_mail($vars) {
$vars["to"] = preg_replace("/.*<(.*)>.*/i", "$1", $vars["to"]);
return $vars;
}
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_mailleoquijano 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
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;
}
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.
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.
/**
* 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 ());
}
/**
* 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 ();
}
Users browsing this forum: Yahoo [Bot] and 1 guest