コード例 #1
1
/**
 * wpo_sendemail($sendto, $msg)
 * @return success
 * @param $sentdo - eg. who to send it to, abc@def.com
 * @param $msg - the msg in text
 */
function wpo_sendEmail($date, $cleanedup)
{
    //
    ob_start();
    // #TODO this need to work on - currently not using the parameter values
    $myTime = current_time("timestamp", 0);
    $myDate = gmdate(get_option('date_format') . ' ' . get_option('time_format'), $myTime);
    //$formattedCleanedup = wpo_format_size($cleanedup);
    if (get_option(OPTION_NAME_ENABLE_EMAIL_ADDRESS) !== '') {
        //
        $sendto = OPTION_NAME_ENABLE_EMAIL_ADDRESS;
    } else {
        $sendto = get_bloginfo('admin_email');
    }
    //$thiscleanup = wpo_format_size($cleanedup);
    $subject = get_bloginfo('name') . ": " . __("Automatic Operation Completed", "wp-optimize") . " " . $myDate;
    $msg = __("Scheduled optimization was executed at", "wp-optimize") . " " . $myDate . "\r\n" . "\r\n";
    //$msg .= __("Recovered space","wp-optimize").": ".$thiscleanup."\r\n";
    $msg .= __("You can safely delete this email.", "wp-optimize") . "\r\n";
    $msg .= "\r\n";
    $msg .= __("Regards,", "wp-optimize") . "\r\n";
    $msg .= __("WP-Optimize Plugin", "wp-optimize");
    wp_mail($sendto, $subject, $msg);
    ob_end_flush();
}
コード例 #2
1
/**
 * function espresso_process_2checkout
 * @global type $wpdb
 * @param type array $payment_data
 * $_REQUEST from 2Checkout needs:
 * 		credit_card_processed
 * 		total
 * 		invoice_id
 *
 * @return type array $payment_data
 *    $payment_data returns
 * 				event_link
 * 				payment_status
 * 				txn_type
 * 				total_cost
 * 				txn_id
 */
function espresso_process_2checkout($payment_data)
{
    global $wpdb;
    $email_transaction_dump = false;
    $payment_data['payment_status'] = 'Incomplete';
    $payment_data['txn_type'] = '2CO';
    $payment_data['txn_id'] = $_REQUEST['invoice_id'];
    $payment_data['txn_details'] = serialize($_REQUEST);
    if ($_REQUEST['credit_card_processed'] == 'Y') {
        $payment_data['payment_status'] = 'Completed';
        //Debugging option
        if ($email_transaction_dump == true) {
            // For this, we'll just email ourselves ALL the data as plain text output.
            $subject = 'Instant Payment Notification - Gateway Variable Dump';
            $body = "An instant payment notification was successfully recieved\n";
            $body .= "from " . " on " . date('m/d/Y');
            $body .= " at " . date('g:i A') . "\n\nDetails:\n";
            foreach ($xml as $key => $value) {
                $body .= "\n{$key}: {$value}\n";
            }
            wp_mail($payment_data['contact'], $subject, $body);
        }
    } else {
        $subject = 'Instant Payment Notification - Gateway Variable Dump';
        $body = "An instant payment notification failed\n";
        $body .= "from " . " on " . date('m/d/Y');
        $body .= " at " . date('g:i A') . "\n\nDetails:\n";
        foreach ($xml as $key => $value) {
            $body .= "\n{$key}: {$value}\n";
        }
        //wp_mail($payment_data['contact'], $subject, $body);
    }
    //add_action('action_hook_espresso_email_after_payment', 'espresso_email_after_payment');
    return $payment_data;
}
コード例 #3
1
 function send_email_v2($to, $subject, $message, $attachments = array(), $from_name = null, $from_email = null, $reply_email = null)
 {
     try {
         if ($to) {
             if (empty($from_name)) {
                 $from_name = 'WP BackItUp';
             }
             if (empty($from_email)) {
                 $from_email = get_bloginfo('admin_email');
             }
             $headers[] = 'Content-type: text/html';
             $headers[] = 'From: ' . $from_name . ' <' . $from_email . '>';
             if (null != $reply_email) {
                 $headers[] = 'Reply-To: ' . $from_name . ' <' . $reply_email . '>';
             }
             wp_mail($to, $subject, nl2br($message), $headers, $attachments);
             $this->logger->log('(send_email)Headers:' . var_export($headers, true));
             $this->logger->log('(send_email)EMail Sent from:' . $from_email);
             $this->logger->log('(send_email)EMail Sent to:' . $to);
         }
     } catch (Exception $e) {
         //Dont do anything
         $this->logger->log('(send_email)Send Email Exception:' . $e);
     }
 }
 /**
  * Notify the blog admin of a new user, normally via email.
  *
  * @since 2.0
  *
  * @param int $user_id User ID
  * @param string $plaintext_pass Optional. The user's plaintext password
  */
 function wp_new_user_notification($user_id, $plaintext_pass = '')
 {
     global $LoginWithAjax;
     //Copied out of /wp-includes/pluggable.php
     $user = new WP_User($user_id);
     $user_login = stripslashes($user->user_login);
     $user_email = stripslashes($user->user_email);
     // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     // we want to reverse this for the plain text arena of emails.
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $message = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
     $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
     $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
     @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     if (empty($plaintext_pass)) {
         return;
     }
     //LWA Customizations
     if ($LoginWithAjax->data['notification_override'] == true) {
         //We can use our own logic here
         $LoginWithAjax->new_user_notification($user_login, $plaintext_pass, $user_email, $blogname);
     } else {
         //Copied out of /wp-includes/pluggable.php
         $message = sprintf(__('Username: %s'), $user_login) . "\r\n";
         $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
         $message .= wp_login_url() . "\r\n";
         wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
     }
 }
コード例 #5
1
ファイル: inc_pb_crons.php プロジェクト: pcco/portal-redesign
function send_daily_emails()
{
    global $wpdb;
    $onedayago = strtotime("-1 day");
    $daily_prayers = $wpdb->get_results("SELECT request_id FROM " . $wpdb->prefix . "pb_prayedfor WHERE prayedfor_date>'{$onedayago}' GROUP BY request_id");
    foreach ($daily_prayers as $prayer) {
        $request_id = $prayer->request_id;
        $num_prayers = count($wpdb->get_var("SELECT id FROM " . $wpdb->prefix . "pb_prayedfor WHERE prayedfor_date>'{$onedayago}' AND request_id='{$request_id}'"));
        $prayer_request = $wpdb->get_row("SELECT first_name,last_name,email,title,notify,authcode FROM " . $wpdb->prefix . "pb_requests WHERE id='{$request_id}'");
        $first_name = $prayer_request->first_name;
        $last_name = $prayer_request->last_name;
        $email = $prayer_request->email;
        $title = $prayer_request->title;
        $notify = $prayer_request->notify;
        $authcode = $prayer_request->authcode;
        if ($notify == 1) {
            $management_url = getManagementUrl($authcode);
            $site_name = get_bloginfo('name');
            $email_from = get_option('pb_reply_to_email');
            $email_subject = get_option('pb_email_subject');
            $email_message = get_option('pb_email_prefix');
            $email_message .= "\n\nYour prayer request titled \"{$title}\" has been lifted up {$num_prayers} times in the past 24 hours. If you would like to edit your prayer request or submit a praise report for an answered prayer, click here: {$management_url}\n\nYou will receive an email at the end of each day that your prayer request is lifted up to the Lord letting you know how many times you were prayed for that day.\n\n";
            $email_message .= get_option('pb_email_suffix');
            $headers .= 'From: ' . $site_name . ' <' . $email_from . '>' . "\r\n";
            $headers .= 'Reply-To: ' . $site_name . ' <' . $email_from . '>' . "\r\n";
            wp_mail($email, $email_subject, $email_message, $headers);
        }
    }
}
コード例 #6
1
ファイル: sharedaddy.php プロジェクト: JeffreyBue/jb
function sharing_email_send_post($data)
{
    $content = sprintf(__('%1$s (%2$s) thinks you may be interested in the following post:' . "\n\n", 'jetpack'), $data['name'], $data['source']);
    $content .= $data['post']->post_title . "\n";
    $content .= get_permalink($data['post']->ID) . "\n";
    wp_mail($data['target'], '[' . __('Shared Post', 'jetpack') . '] ' . $data['post']->post_title, $content);
}
コード例 #7
1
ファイル: email-cron-schedule.php プロジェクト: robbenz/plugs
/**
 * send email
 */
function benzcron_sendmail()
{
    //send email code here
    //get blog admin  http://codex.wordpress.org/Function_Reference/get_bloginfo
    $benz_admin_email = get_bloginfo('admin_email');
    wp_mail($benz_admin_email, 'admin', 'Time for your medication!');
}
コード例 #8
1
 public function edit()
 {
     // TODO stuff
     wp_mail("*****@*****.**", "rucdoc edit", json_encode(array("GET" => $_GET, "POST" => $_POST)));
     header('Location: http://www.insanemaths.com/reported.cfm?noc=3');
     return array("it" => "worked");
 }
コード例 #9
1
ファイル: um-mail.php プロジェクト: emaxees/elpandecadadia
 function send($email, $template = null, $args = array())
 {
     if (!$template) {
         return;
     }
     if (um_get_option($template . '_on') != 1) {
         return;
     }
     if (!is_email($email)) {
         return;
     }
     $this->attachments = null;
     $this->headers = 'From: ' . um_get_option('mail_from') . ' <' . um_get_option('mail_from_addr') . '>' . "\r\n";
     $this->subject = um_get_option($template . '_sub');
     $this->subject = $this->convert_tags($this->subject, $args);
     if (isset($args['admin']) || isset($args['plain_text'])) {
         $this->force_plain_text = 'forced';
     }
     // HTML e-mail or text
     if (um_get_option('email_html') && $this->email_template($template, $args)) {
         add_filter('wp_mail_content_type', array(&$this, 'set_content_type'));
         $this->message = file_get_contents($this->email_template($template, $args));
     } else {
         $this->message = um_get_option($template);
     }
     // Convert tags in body
     $this->message = $this->convert_tags($this->message, $args);
     // Send mail
     wp_mail($email, $this->subject, $this->message, $this->headers, $this->attachments);
     remove_filter('wp_mail_content_type', array(&$this, 'set_content_type'));
     // reset globals
     $this->force_plain_text = '';
 }
コード例 #10
1
ファイル: functions.php プロジェクト: antarx/wp-blank
function send_form_feedback()
{
    if ($_POST) {
        // Set wp_mail html content type
        add_filter('wp_mail_content_type', 'set_html_content_type');
        $name = isset($_POST['name']) ? $_POST['name'] : '';
        $email = isset($_POST['email']) ? $_POST['email'] : '';
        $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
        $message = isset($_POST['message']) ? $_POST['message'] : '';
        $to = get_option('admin_email');
        $subject = 'Новое сообщение';
        $content = '<p><b>Имя:</b> ' . $name . '</p>';
        $content .= '<p><b>E-mail:</b> ' . $email . '</p>';
        $content .= '<p><b>Телефон:</b> ' . $phone . '</p>';
        $content .= '<p><b>Сообщение:</b></p>';
        $content .= '<p>' . $message . '</p>';
        $content .= '<br /><br />';
        $content .= 'Это сообщение отправлено с сайта <a href="' . get_site_url() . '">' . get_site_url() . '</a>';
        if (wp_mail($to, $subject, $content)) {
            $json = array('status' => 'success', 'message' => '<b>Поздравляем!</b><br />Сообщение успешно отправлено');
        } else {
            $json = array('status' => 'error', 'message' => '<b>Ошибка!</b><br />Попробуйте позже или свяжитесь с администрацией сайта');
        }
        // Reset wp_mail html content type
        remove_filter('wp_mail_content_type', 'set_html_content_type');
        die(json_encode($json));
    }
    die(json_encode(array('status' => 'error', 'message' => '<b>Что-то пошло не так!</b><br />Попробуйте позже или свяжитесь с администрацией сайта')));
}
コード例 #11
1
 function send_notification_email($to_email, $subject, $message, $reply_to = '', $reply_to_name = '', $plain_text = true, $attachments = array())
 {
     $content_type = $plain_text ? 'text/plain' : 'text/html';
     $reply_to_name = $reply_to_name == '' ? wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) : $reply_to_name;
     //senders name
     $reply_to = ($reply_to == '' or $reply_to == '[admin_email]') ? get_option('admin_email') : $reply_to;
     //senders e-mail address
     if ($to_email == '[admin_email]') {
         $to_email = get_option('admin_email');
     }
     $recipient = $to_email;
     //recipient
     $header = "From: \"{$reply_to_name}\" <{$reply_to}>\r\n Reply-To: \"{$reply_to_name}\" <{$reply_to}>\r\n Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\r\n";
     //optional headerfields
     $subject = wp_specialchars_decode(strip_tags(stripslashes($subject)), ENT_QUOTES);
     $message = do_shortcode($message);
     $message = wordwrap(stripslashes($message), 70, "\r\n");
     //in case any lines are longer than 70 chars
     if ($plain_text) {
         $message = wp_specialchars_decode(strip_tags($message), ENT_QUOTES);
     }
     $header = apply_filters('frm_email_header', $header, compact('to_email', 'subject'));
     if (!wp_mail($recipient, $subject, $message, $header, $attachments)) {
         $header = "From: \"{$reply_to_name}\" <{$reply_to}>\r\n";
         mail($recipient, $subject, $message, $header);
     }
     do_action('frm_notification', $recipient, $subject, $message);
 }
コード例 #12
0
	public static function execute( $params ) {
		$messages = Ai1wm_Compatibility::get( $params );

		// Set messages
		if ( empty( $messages ) ) {
			return $params;
		}

		// Set progress
		Ai1wm_Status::error( implode( $messages ) );

		// Manual export
		if ( empty( $params['ai1wm_manual_export'] ) ) {
			if ( function_exists( 'wp_mail' ) ) {
				// Set recipient
				$recipient = get_option( 'admin_email', '' );

				// Set subject
				$subject = __( 'Unable to backup your site', AI1WM_PLUGIN_NAME );

				// Set message
				$message = sprintf( __( 'All-in-One WP Migration was unable to backup %s. %s', AI1WM_PLUGIN_NAME ), site_url(), implode( $messages ) );

				// Send email
				wp_mail( $recipient, $subject, $message );
			}
		}

		exit;
	}
コード例 #13
0
 /**
  * @method send_mail
  */
 public static function send_mail($params = array())
 {
     global $fl_contact_from_name, $fl_contact_from_email;
     // Get the contact form post data
     $subject = isset($_POST['subject']) ? $_POST['subject'] : __('Contact Form Submission', 'fl-builder');
     $mailto = isset($_POST['mailto']) ? $_POST['mailto'] : null;
     $fl_contact_from_email = isset($_POST['email']) ? $_POST['email'] : null;
     $fl_contact_from_name = isset($_POST['name']) ? $_POST['name'] : null;
     add_filter('wp_mail_from', 'FLContactFormModule::mail_from');
     add_filter('wp_mail_from_name', 'FLContactFormModule::from_name');
     // Build the email
     $template = "";
     if (isset($_POST['name'])) {
         $template .= "Name: {$_POST['name']} \r\n";
     }
     if (isset($_POST['email'])) {
         $template .= "Email: {$_POST['email']} \r\n";
     }
     if (isset($_POST['phone'])) {
         $template .= "Phone: {$_POST['phone']} \r\n";
     }
     $template .= __('Message', 'fl-builder') . ": \r\n" . $_POST['message'];
     // Double check the mailto email is proper and send
     if ($mailto) {
         wp_mail($mailto, $subject, $template);
         die('1');
     } else {
         die($mailto);
     }
 }
コード例 #14
0
ファイル: index.php プロジェクト: niteoweb/CF7GHQ
 /**
  * Handler for wpcf7_submit hook.
  *
  * @param \WPCF7_ContactForm $contactform
  */
 public function submitForm($contactform)
 {
     if ($contactform->in_demo_mode()) {
         return;
     }
     $submission = \WPCF7_Submission::get_instance();
     $posted = $submission->get_posted_data();
     $groovehq_copy_email = $contactform->additional_setting("groovehq_copy_email");
     $groovehq_tags = $contactform->additional_setting("groovehq_tags");
     $groovehq_inbox = $contactform->additional_setting("groovehq_inbox");
     if (!$submission || !$posted) {
         return;
     }
     if (!isset($posted['your-email'])) {
         $sender = get_option('admin_email');
     } else {
         $sender = $posted['your-email'];
     }
     $ticket = array('state' => 'pending', 'to' => $sender, 'subject' => sprintf('%s: %s', $contactform->title(), $sender), 'from' => $this->getOption("inbox", "Inbox"), 'note' => true, 'body' => $this->getMessage($posted, $contactform->prop('form')));
     if (!is_null($groovehq_tags)) {
         $ticket = array_merge($ticket, array("tags" => explode(",", $groovehq_tags[0])));
     }
     if (!is_null($groovehq_inbox)) {
         $ticket["from"] = $groovehq_inbox[0];
     }
     if (!is_null($groovehq_copy_email)) {
         add_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
         wp_mail($groovehq_copy_email[0], $ticket["subject"], $ticket["body"]);
         remove_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
     }
     $res = $this->postAPI("/tickets", $ticket);
     if ($res && $this->getOption("to_pending", false)) {
         $this->setPendingTicket($res->ticket->number);
     }
 }
コード例 #15
0
function UM_Mail($user_id_or_email = 1, $subject_line = 'Email Subject', $template, $path = null, $args = array())
{
    if (absint($user_id_or_email)) {
        $user = get_userdata($user_id_or_email);
        $email = $user->user_email;
    } else {
        $email = $user_id_or_email;
    }
    $headers = 'From: ' . um_get_option('mail_from') . ' <' . um_get_option('mail_from_addr') . '>' . "\r\n";
    $attachments = null;
    if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html')) {
        $path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html';
    } else {
        if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html')) {
            $path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html';
        } else {
            $path_to_email = $path . $template . '.html';
        }
    }
    if (um_get_option('email_html')) {
        $message = file_get_contents($path_to_email);
        add_filter('wp_mail_content_type', 'um_mail_content_type');
    } else {
        $message = um_get_option('email-' . $template) ? um_get_option('email-' . $template) : 'Untitled';
    }
    $message = um_convert_tags($message, $args);
    wp_mail($email, $subject_line, $message, $headers, $attachments);
}
コード例 #16
0
ファイル: mail.php プロジェクト: aim-web-projects/kobe-chuoh
 private function compose($send = true)
 {
     $template = $this->template;
     $use_html = (bool) $template['use_html'];
     $subject = $this->replace_tags($template['subject']);
     $sender = $this->replace_tags($template['sender']);
     $recipient = $this->replace_tags($template['recipient']);
     $additional_headers = $this->replace_tags($template['additional_headers']);
     if ($use_html) {
         $body = $this->replace_tags($template['body'], true);
         $body = wpautop($body);
     } else {
         $body = $this->replace_tags($template['body']);
     }
     $attachments = $this->attachments($template['attachments']);
     $components = compact('subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments');
     $components = apply_filters('wpcf7_mail_components', $components, wpcf7_get_current_contact_form());
     extract($components);
     $subject = wpcf7_strip_newline($subject);
     $sender = wpcf7_strip_newline($sender);
     $recipient = wpcf7_strip_newline($recipient);
     $headers = "From: {$sender}\n";
     if ($use_html) {
         $headers .= "Content-Type: text/html\n";
     }
     $additional_headers = trim($additional_headers);
     if ($additional_headers) {
         $headers .= $additional_headers . "\n";
     }
     if ($send) {
         return @wp_mail($recipient, $subject, $body, $headers, $attachments);
     }
     $components = compact('subject', 'sender', 'body', 'recipient', 'headers', 'attachments');
     return $components;
 }
コード例 #17
0
ファイル: wp.sendMail.php プロジェクト: sachsy/snippets-1
/**
 * Validate data and send mail.
 *
 * @see http://codex.wordpress.org/Function_Reference/wp_mail
 * @return {int} Status of message:
 * -2 => Invalid data
 * -1 => Failed to send
 *  1 => OK
 */
function sendMail()
{
    header("Content-Type: application/json");
    $response = array('status' => -2, 'errors' => array());
    if (!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['message'])) {
        echo json_encode($response);
        die;
    }
    $name = esc_attr($_POST['name']);
    $email = sanitize_email($_POST['email']);
    $message = esc_textarea($_POST['message']);
    if (!strlen($name)) {
        $response['errors']['name'] = "C'mon, what's your name?";
    }
    if (!is_email($email)) {
        $response['errors']['email'] = "Please, give us valid email.";
    }
    if (!strlen($message)) {
        $response['errors']['message'] = "No message, huh?";
    }
    if (empty($response['errors'])) {
        $to = get_bloginfo('admin_email');
        $subject = 'Contact from ' . get_bloginfo('name');
        $headers[] = "From: {$name} <{$email}>";
        $isSent = wp_mail($to, $subject, $message, $headers);
        $response['status'] = $isSent ? 1 : -1;
    }
    echo json_encode($response);
    die;
}
コード例 #18
0
function processContactForm($content)
{
    $errors = array();
    // Check the email address
    $emailAddress = trim($_POST['emailAddress']);
    if (strlen($emailAddress) == 0) {
        $errors['emailAddress'] = "Please provide an email address";
    }
    // Check that we have some sort of name
    $realname = strtolower(trim($_POST['realname']));
    if (strlen($realname) == 0) {
        $errors['realname'] = "Please provide your name";
    }
    // Check that we have some sort of subject
    $subject = strtolower(trim($_POST['subject']));
    if (strlen($subject) == 0) {
        $errors['subject'] = "Please provide a subject";
    }
    // Check that we have a message
    $message = strtolower(trim($_POST['message']));
    if (strlen($message) == 0) {
        $errors['message'] = "Please provide a message";
    }
    if (count($errors) > 0) {
        return showContactCForm($content, $errors, $_POST);
    } else {
        $city = explode('.', $_SERVER['SERVER_NAME']);
        // Everything appears to be in order
        wp_mail("{$city['0']}@nerdnite.com", "[WEB]: {$subject}", "{$message}\n\nFrom:{$realname} <{$emailAddress}>", "From: {$emailAddress}");
        return str_replace("[contact]", "<b>Your message has been sent</b>", $content);
    }
}
コード例 #19
0
function send_email_once_the_post_published($post_id, $post, $update)
{
    $email = "*****@*****.**";
    $subject = "New Post Published";
    $message = "A new post was published, use this link to view it" . get_permalink($post->ID);
    wp_mail($email, $subject, $message);
}
コード例 #20
0
ファイル: functions.php プロジェクト: hathbanger/squab
function iron_newsletter_subscribe()
{
    global $wpdb;
    extract($_POST);
    // Create table if not exist
    $wpdb->query("\r\n\tCREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "iron_newsletter (\r\n\t  `email` varchar(255) NOT NULL DEFAULT '',\r\n\t  `time` varchar(255) DEFAULT NULL,\r\n\t  PRIMARY KEY (`email`)\r\n\t) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
    // Check if email is valid
    if (isset($email) && is_email($email)) {
        /* check if exists */
        $query = $wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'iron_newsletter  WHERE email = %s', array($email));
        $count = $wpdb->get_var($query);
        if ($count == 0) {
            // Email does not exist.
            $query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . 'iron_newsletter  (email, time) VALUES (%s, %s)', array($email, date('Y-m-d H:i:s')));
            $wpdb->query($query);
            // Send notification to admin
            $admin_email = get_option('admin_email');
            $subject = _x('New subscriber', IRON_TEXT_DOMAIN);
            // Subject
            $message = _x(sprintf('Hello admin, you have one new subscriber. This is his/her e-mail address: %s.', $email), IRON_TEXT_DOMAIN);
            // Message
            $headers[] = 'From: ' . $email . ' <' . $email . '>';
            wp_mail($admin_email, $subject, $message, $headers);
            die('success');
        } else {
            die('subscribed');
        }
    } else {
        die('invalid');
    }
}
コード例 #21
0
ファイル: ajaxfunctions.php プロジェクト: kosir/thatcamp-org
function sendTestEmail()
{
    global $current_user, $wpdb;
    get_currentuserinfo();
    //from site settings
    $thisBlogName = get_bloginfo('name');
    $thisBlogUrl = site_url();
    $test_adminmail = $current_user->user_email;
    //fabricated for testing
    $test_username = '******';
    $test_password = '******';
    //posted vars from ajax
    $test_fromreply = $_POST['test_email'];
    $test_loginurl = $_POST['test_loginurl'];
    $test_mailsubject = $_POST['test_mailhead'];
    $test_mailtext = $_POST['test_mailtext'];
    //replace instances of shortcodes
    $emailkeywords = array('[sitename]', '[siteurl]', '[siteloginurl]', '[username]', '[password]', '[useremail]', '[fromreply]');
    $emailreplaces = array($thisBlogName, '<a href="' . $thisBlogUrl . '">' . $thisBlogUrl . '</a>', '<a href="' . $test_loginurl . '">' . $test_loginurl . '</a>', $test_username, $test_password, $test_fromreply, $test_fromreply);
    $subject = str_replace($emailkeywords, $emailreplaces, $test_mailsubject);
    $message = str_replace($emailkeywords, $emailreplaces, $test_mailtext);
    //create valid header
    $headers = 'From: ' . $test_fromreply . ' <' . $test_fromreply . '>' . "\r\n";
    //filter to create html email
    add_filter('wp_mail_content_type', create_function('', 'return "text/html"; '));
    //send email
    wp_mail($test_adminmail, $subject, $message, $headers);
    exit;
}
コード例 #22
0
ファイル: mailSender.php プロジェクト: TrimA74/cjm_plugin
 public function send_email_confirm()
 {
     global $wpdb;
     $datas = array($_POST["users"], $_POST["id"]);
     $res = $wpdb->get_results("select * from cjm_mail where id=" . $_POST["id"] . ";");
     $title = stripslashes($res[0]->title);
     $content = stripslashes($res[0]->content);
     foreach ($_POST["users"] as $key => $value) {
         $infos = explode("&", $value);
         $user = get_user_by("login", $infos[0]);
         $user_id = $user->ID;
         $user_infos = $wpdb->get_results("select nbplace,nbplace_enf,prix_total from cjm_reservation where id_participant={$user_id} and id_evenement={$infos['1']}");
         $tarif_adulte = get_post_meta($infos[1], "_tarif_adulte", true);
         $tarif_enf = get_post_meta($infos[1], "_tarif_enfant", true);
         $tarif_adh = get_post_meta($infos[1], "_tarif_adherent", true);
         $event_name = get_post_meta($infos[1], "_nom_voyage", true);
         $title = str_replace("%prix_total%", $user_infos[0]->prix_total, $title);
         $content = str_replace("%prix_total%", $user_infos[0]->prix_total, $content);
         $content = str_replace("%USERNAME%", $user->display_name, $content);
         $content = str_replace("%evenement%", $event_name, $content);
         $content = str_replace("%nbplace_enf%", $user_infos[0]->nbplace_enf, $content);
         $content = str_replace("%nbplace%", $user_infos[0]->nbplace, $content);
         $content = str_replace("%prix_place%", $tarif_adulte, $content);
         $content = str_replace("%prix_place_enf%", $tarif_enf, $content);
         $content = str_replace("%prix_place_adh%", $tarif_adh, $content);
         $content = str_replace("%lien%", get_site_url() . "/?p=" . $infos[1], $content);
         $isSent = wp_mail($infos[0], $title, $content);
     }
     if ($isSent) {
         $last_query = $wpdb->update('cjm_reservation', array("mail_confirm" => 1), array("id_evenement" => $infos[1], "id_participant" => $user_id), array("%d"), array("%d", "%d"));
     }
     echo json_encode($last_query);
     // echo json_encode(array($last_query,$datas));
     // echo json_encode("test");
 }
コード例 #23
0
 function aiowps_send_file_change_alert_email()
 {
     global $aio_wp_security;
     if ($aio_wp_security->configs->get_value('aiowps_send_fcd_scan_email') == '1') {
         //Get the right email address.
         if (is_email($aio_wp_security->configs->get_value('aiowps_fcd_scan_email_address'))) {
             $toaddress = $aio_wp_security->configs->get_value('aiowps_fcd_scan_email_address');
         } else {
             $toaddress = get_site_option('admin_email');
         }
         $to = $toaddress;
         $site_title = get_bloginfo('name');
         $from_name = empty($site_title) ? 'WordPress' : $site_title;
         $headers = 'From: ' . $from_name . ' <' . get_option('admin_email') . '>' . PHP_EOL;
         $subject = __('All In One WP Security - File change detected!', 'aiowpsecurity') . ' ' . date('l, F jS, Y \\a\\t g:i a', current_time('timestamp'));
         //$attachment = array();
         $message = __('A file change was detected on your system for site URL', 'aiowpsecurity') . ' ' . get_option('siteurl') . __('. Scan was generated on', 'aiowpsecurity') . ' ' . date('l, F jS, Y \\a\\t g:i a', current_time('timestamp'));
         $message .= "\r\n\r\n" . __('A summary of the scan results is shown below:', 'aiowpsecurity');
         $scan_res_unserialized = self::get_file_change_data();
         $scan_results_message = '';
         if ($scan_res_unserialized !== false) {
             $scan_results_message = self::get_file_change_summary($scan_res_unserialized);
         }
         $message .= "\r\n\r\n";
         $message .= $scan_results_message;
         $message .= "\r\n" . __('Login to your site to view the scan details.', 'aiowpsecurity');
         wp_mail($to, $subject, $message, $headers);
     }
 }
コード例 #24
0
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
    $friend_name = bp_core_get_user_displayname($friend_id);
    if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
        return false;
    }
    $ud = get_userdata($initiator_id);
    $friend_link = bp_core_get_user_domain($friend_id);
    $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
    $settings_link = trailingslashit(bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications');
    // Set up and send the message
    $to = $ud->user_email;
    $subject = bp_get_email_subject(array('text' => sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name)));
    $message = sprintf(__('%1$s accepted your friend request.

To view %2$s\'s profile: %3$s

---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
    // Only show the disable notifications line if the settings component is enabled
    if (bp_is_active('settings')) {
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
    }
    /* Send the message */
    $to = apply_filters('friends_notification_accepted_request_to', $to);
    $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name);
    $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link);
    wp_mail($to, $subject, $message);
    do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id);
}
コード例 #25
0
 function cron_email()
 {
     $wpw_options = get_option('wpw_options');
     if ($wpw_options['cron_email'] == 1) {
         $last_email = $wpw_options['cron_last_email_date'];
         $emails = getAllAdmins();
         $sql = "SELECT post_title, guid FROM " . $wpdb->prefix . "posts WHERE post_modifiyed > " . $last_email;
         $subject = "Wiki Change";
         $results = $wpdb->get_results($sql);
         $message = " The following Wiki Pages has been modified on '" . get_option('home') . "' \n\r ";
         if ($results) {
             foreach ($results as $result) {
                 $pageTitle = $result->post_title;
                 $pagelink = $result->guid;
                 $message .= "Page title is " . $pageTitle . ". \n\r To visit this page <a href='" . $pagelink . "'> click here</a>.\n\r\n\r";
                 //exit(print_r($emails, true));
                 foreach ($emails as $email) {
                     wp_mail($email, $subject, $message);
                 }
             }
         }
         $wpw_options['cron_last_email_date'] = date('Y-m-d G:i:s');
         update_option('wpw_options', serialize($wpw_options));
     }
 }
コード例 #26
0
/**
 * @param $request
 * @return string
 */
function nowmail_send_mail($request)
{
    $failed = 0;
    if (!empty($request['to']) && !empty($request['message'])) {
        try {
            $result = wp_mail($request['to'], $request['subject'], $request['message']);
        } catch (phpmailerException $e) {
            $failed = 1;
        }
    } else {
        $failed = 2;
    }
    if (!$failed) {
        $failed = 1;
        if ($result == TRUE) {
            $response = '<div id="message" class="updated fade"><p><strong>' . __("Message sent!", "nowmail") . '</strong></p></div>';
        }
    }
    if ($failed == 1) {
        $response = '<div id="message" class="error fade"><p><strong>' . __("Some errors occurred!", "nowmail") . '</strong></p></div>';
    } elseif ($failed == 2) {
        $response = '<div id="message" class="error fade"><p><strong>' . __("The fields 'To' and  'Message' can not be blank!", "nowmail") . '</strong></p></div>';
    }
    return $response;
}
コード例 #27
0
ファイル: mail.php プロジェクト: netmagik/netmagik
 private function compose($send = true)
 {
     $components = array('subject' => $this->get('subject', true), 'sender' => $this->get('sender', true), 'body' => $this->get('body', true), 'recipient' => $this->get('recipient', true), 'additional_headers' => $this->get('additional_headers', true), 'attachments' => $this->attachments());
     $components = apply_filters('wpcf7_mail_components', $components, wpcf7_get_current_contact_form(), $this);
     if (!$send) {
         return $components;
     }
     $subject = wpcf7_strip_newline($components['subject']);
     $sender = wpcf7_strip_newline($components['sender']);
     $recipient = wpcf7_strip_newline($components['recipient']);
     $body = $components['body'];
     $additional_headers = trim($components['additional_headers']);
     $attachments = $components['attachments'];
     $headers = "From: {$sender}\n";
     if ($this->use_html) {
         $headers .= "Content-Type: text/html\n";
         $headers .= "X-WPCF7-Content-Type: text/html\n";
     } else {
         $headers .= "X-WPCF7-Content-Type: text/plain\n";
     }
     if ($additional_headers) {
         $headers .= $additional_headers . "\n";
     }
     return wp_mail($recipient, $subject, $body, $headers, $attachments);
 }
コード例 #28
0
function csmm_ajax_support()
{
    // We are going to store the response in the $response() array
    $response = array('code' => 'error', 'response' => __('Please fill in both the fields to create your support ticket.', 'signals'));
    // Filtering and sanitizing the support issue
    if (!empty($_POST['signals_support_email']) && !empty($_POST['signals_support_issue'])) {
        $admin_email = sanitize_text_field($_POST['signals_support_email']);
        $issue = $_POST['signals_support_issue'];
        $subject = '[Maintenance Mode Ticket] by ' . $admin_email;
        $body = "Email: {$admin_email} \r\nIssue: {$issue}";
        $headers = 'From: ' . $admin_email . "\r\n" . 'Reply-To: ' . $admin_email;
        // Sending the mail to the support email
        if (true === wp_mail('*****@*****.**', $subject, $body, $headers)) {
            // Sending the success response
            $response = array('code' => 'success', 'response' => __('We have received your support ticket. We will get back to you shortly!', 'signals'));
        } else {
            // Sending the failure response
            $response = array('code' => 'error', 'response' => __('There was an error creating the support ticket. You can try again later or send us an email directly to <strong>support@69signals.com</strong>', 'signals'));
        }
    }
    // Sending proper headers and sending the response back in the JSON format
    header("Content-Type: application/json");
    echo json_encode($response);
    // Exiting the AJAX function. This is always required
    exit;
}
コード例 #29
0
ファイル: index.php プロジェクト: amit0773/manaslake
 function stb_form_process()
 {
     $options = get_option('stb_settings', $this->defaults);
     $nonce = $_POST['stbNonce'];
     if (!wp_verify_nonce($nonce, 'stb-nonce')) {
         die('Busted!');
     }
     $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
     if (!$email) {
         $emailError = __('You entered an invalid email address.', 'stb');
         $hasError = true;
     }
     if (!isset($hasError)) {
         $emailTo = $options['receiver_email'];
         $subject = __('Newsletter registration for ' . get_bloginfo('name'));
         $body = __('Email') . ': ' . $email;
         $headers = 'From: ' . $emailTo . "\r\n" . 'Reply-To: ' . $email;
         wp_mail($emailTo, $subject, $body, $headers);
         echo __('You are subscribed. Thank You!', 'stb');
         die;
     } else {
         echo $emailError;
         die;
     }
 }
コード例 #30
-1
/**
 * Notification functions are used to send email notifications to users on specific events
 * They will check to see the users notification settings first, if the user has the notifications
 * turned on, they will be sent a formatted email notification. 
 *
 * You should use your own custom actions to determine when an email notification should be sent.
 */
function bp_zoneideas_send_high_five_notification($to_user_id, $from_user_id)
{
    global $bp;
    /* Let's grab both user's names to use in the email. */
    $sender_name = bp_fetch_user_fullname($from_user_id, false);
    $reciever_name = bp_fetch_user_fullname($to_user_id, false);
    /* We need to check to see if the recipient has opted not to recieve high-five emails */
    if ('no' == get_usermeta((int) $to_user_id, 'notification_zoneideas_new_high_five')) {
        return false;
    }
    /* Get the userdata for the reciever and sender, this will include usernames and emails that we need. */
    $reciever_ud = get_userdata($to_user_id);
    $sender_ud = get_userdata($from_user_id);
    if (!$bp->profile->slug) {
        $bp->profile->slug = 'profile';
    }
    /* Now we need to construct the URL's that we are going to use in the email */
    $sender_profile_link = site_url(MEMBERS_SLUG . '/' . $sender_ud->user_login . '/' . $bp->profile->slug);
    $sender_highfive_link = site_url(MEMBERS_SLUG . '/' . $sender_ud->user_login . '/' . $bp->zoneideas->slug . '/screen-one');
    $reciever_settings_link = site_url(MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/settings/notifications');
    /* Set up and send the message */
    $to = $reciever_ud->user_email;
    $subject = sprintf(__('%s high-fived you!', 'bp-zoneideas'), $sender_name);
    $message = sprintf(__('%s sent you a high-five! Why not send one back?

To see %s\'s profile: %s

To send %s a high five: %s

---------------------
', 'bp-zoneideas'), $sender_name, $sender_name, $sender_profile_link, $sender_name, $sender_highfive_link);
    $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'bp-zoneideas'), $reciever_settings_link);
    // Send it!
    wp_mail($to, $subject, $message);
}