function akst_send_mail() { global $akst_limit_mail_recipients; $post_id = ''; $to = ''; $name = ''; $email = ''; if (!empty($_REQUEST['akst_to'])) { $to = stripslashes($_REQUEST['akst_to']); $to = strip_tags($to); $to = str_replace(array("\n", "\t", "\r"), array(), $to); } $to = str_replace(array(',', ';'), ' ', $to); if (strstr($to, ' ')) { $temp = explode(' ', $to); $to = array(); foreach ($temp as $email) { if (!empty($email)) { $to[] = $email; } } } else { $to = array($to); } $to = array_unique($to); if (count($to) == 0) { wp_die(sprintf(__('Please make sure you have entered an e-mail address to sent this to. Click your <strong>back button</strong> and try again.', 'share-this'), $akst_limit_mail_recipients)); } if (count($to) > $akst_limit_mail_recipients) { wp_die(sprintf(__('Sorry, you can only send this to %d people at once. Click your <strong>back button</strong> and try again.', 'share-this'), $akst_limit_mail_recipients)); } if (!empty($_REQUEST['akst_name'])) { $name = stripslashes($_REQUEST['akst_name']); $name = strip_tags($name); $name = str_replace(array('"', "\n", "\t", "\r"), array(), $name); } if (!empty($_REQUEST['akst_email'])) { $email = stripslashes($_REQUEST['akst_email']); $email = strip_tags($email); $email = str_replace(array(',', "\n", "\t", "\r"), array(), $email); } if (!empty($_REQUEST['akst_post_id'])) { $post_id = intval($_REQUEST['akst_post_id']); } $valid_email = 0; foreach ($to as $address) { if (ak_check_email_address($address)) { $valid_email++; } } if (empty($post_id) || empty($to) || count($to) != $valid_email || empty($email) || !ak_check_email_address($email)) { wp_die(__('Oops, please click your <strong>back button</strong> and make sure those e-mail addresses are correct, then try again.', 'share-this')); } $headers = "MIME-Version: 1.0\n" . 'From: "' . $name . '" <' . $email . '>' . "\n" . 'Reply-To: "' . $name . '" <' . $email . '>' . "\n" . 'Return-Path: "' . $name . '" <' . $email . '>' . "\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $subject = __('Check out this post on ', 'share-this') . get_bloginfo('name'); $post =& get_post($post_id); $excerpt = $post->post_excerpt; if (empty($excerpt)) { $excerpt = strip_tags(get_the_content()); if (strlen($excerpt) > 250) { $excerpt = substr($excerpt, 0, 247) . '...'; } } $message = __('Greetings--', 'share-this') . "\n\n" . $name . __(' thinks this will be of interest to you:', 'share-this') . "\n\n" . ak_decode_entities(get_the_title($post_id)) . "\n\n" . $excerpt . "\n\n" . get_permalink($post_id) . "\n\n" . __('Enjoy.', 'share-this') . "\n\n" . '--' . "\n" . get_bloginfo('home') . "\n"; foreach ($to as $recipient) { @wp_mail($recipient, $subject, $message, $headers); } if (!empty($_SERVER['HTTP_REFERER'])) { $url = $_SERVER['HTTP_REFERER']; } wp_die(__('Thanks, we\'ve sent this article to your recipients via e-mail.', 'share-this') . ' <a href="' . get_permalink($post_id) . '">' . __('Return to original page', 'share-this') . '</a>.'); /* header("Location: $url"); status_header('302'); die(); */ }
function wpsc_akst_send_mail() { //exit("<pre>".print_r($_REQUEST,true)."</pre>"); $post_id = ''; $to = ''; $name = ''; $email = ''; if (!empty($_REQUEST['wpsc_akst_to'])) { $to = stripslashes($_REQUEST['wpsc_akst_to']); $to = strip_tags($to); $to = str_replace(array(',', "\n", "\t", "\r"), array(), $to); } if (!empty($_REQUEST['wpsc_akst_name'])) { $name = stripslashes($_REQUEST['wpsc_akst_name']); $name = strip_tags($name); $name = str_replace(array('"', "\n", "\t", "\r"), array(), $name); } if (!empty($_REQUEST['wpsc_akst_email'])) { $email = stripslashes($_REQUEST['wpsc_akst_email']); $email = strip_tags($email); $email = str_replace(array(',', "\n", "\t", "\r"), array(), $email); } if (!empty($_REQUEST['wpsc_akst_post_id'])) { $post_id = intval($_REQUEST['wpsc_akst_post_id']); } if (empty($to) || !ak_check_email_address($to) || empty($email) || !ak_check_email_address($email)) { wp_die(__('Click your <strong>back button</strong> and make sure those e-mail addresses are valid then try again.', 'alexking.org')); } // $post = &get_post($post_id); $headers = "MIME-Version: 1.0\n" . 'From: "' . $name . '" <' . $email . '>' . "\n" . 'Reply-To: "' . $name . '" <' . $email . '>' . "\n" . 'Return-Path: "' . $name . '" <' . $email . '>' . "\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $subject = __('Check out this product on ', 'alexking.org') . get_bloginfo('name'); if (is_numeric($_REQUEST['wpsc_akst_product_id'])) { $permalink = get_option('product_list_url'); $message .= __('Greetings--', 'alexking.org') . "\n\n"; $message .= $name . __(' thinks this will be of interest to you:', 'alexking.org') . "\n\n"; //$message .= ak_decode_entities(get_the_title($post_id))."\n\n"; if (strstr($permalink, "?") !== false) { $message .= $permalink . "&product_id=" . $_REQUEST['wpsc_akst_product_id'] . "\n\n"; } else { $message .= $permalink . "?product_id=" . $_REQUEST['wpsc_akst_product_id'] . "\n\n"; } $message .= __('Enjoy.', 'alexking.org') . "\n\n"; $message .= '--' . "\n"; $message .= get_bloginfo('home') . "\n"; } else { $message = __('Greetings--', 'alexking.org') . "\n\n" . $name . __(' thinks this will be of interest to you:', 'alexking.org') . "\n\n" . ak_decode_entities(get_the_title($post_id)) . "\n\n" . get_permalink($post_id) . "\n\n" . __('Enjoy.', 'alexking.org') . "\n\n" . '--' . "\n" . get_bloginfo('home') . "\n"; } @wp_mail($to, $subject, $message, $headers); if (!empty($_SERVER['HTTP_REFERER'])) { $url = $_SERVER['HTTP_REFERER']; } header("Location: {$url}"); status_header('302'); die; }
function akst_send_mail() { $post_id = ''; $to = ''; $name = ''; $email = ''; if (!empty($_REQUEST['akst_to'])) { $to = stripslashes($_REQUEST['akst_to']); $to = strip_tags($to); $to = str_replace(array(',', "\n", "\t", "\r"), array(), $to); } if (!empty($_REQUEST['akst_name'])) { $name = stripslashes($_REQUEST['akst_name']); $name = strip_tags($name); $name = str_replace(array('"', "\n", "\t", "\r"), array(), $name); } if (!empty($_REQUEST['akst_email'])) { $email = stripslashes($_REQUEST['akst_email']); $email = strip_tags($email); $email = str_replace(array(',', "\n", "\t", "\r"), array(), $email); } if (!empty($_REQUEST['akst_post_id'])) { $post_id = intval($_REQUEST['akst_post_id']); } if (empty($post_id) || empty($to) || !ak_check_email_address($to) || empty($email) || !ak_check_email_address($email)) { wp_die(__('返回,并检查你的E-mail是否填写正确,然后再试一次...', 'alexking.org')); } // $post = &get_post($post_id); $headers = "MIME-Version: 1.0\n" . 'From: "' . $name . '" <' . $email . '>' . "\n" . 'Reply-To: "' . $name . '" <' . $email . '>' . "\n" . 'Return-Path: "' . $name . '" <' . $email . '>' . "\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $subject = __('你的礼物存放于: ', 'alexking.org') . get_bloginfo('name'); $message = __('你好啊--', 'alexking.org') . "\n\n" . $name . __(' 看到了这个,或许你也会喜欢,所以他发给你了:', 'alexking.org') . "\n\n" . ak_decode_entities(get_the_title($post_id)) . "\n\n" . get_permalink($post_id) . "\n\n" . __('希望你也喜欢!', 'alexking.org') . "\n\n" . '--' . "\n" . get_bloginfo('home') . "\n"; @wp_mail($to, $subject, $message, $headers); if (!empty($_SERVER['HTTP_REFERER'])) { $url = $_SERVER['HTTP_REFERER']; } header("Location: {$url}"); status_header('302'); die; }