當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_mail函數代碼示例

本文整理匯總了PHP中wp_mail函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_mail函數的具體用法?PHP wp_mail怎麽用?PHP wp_mail使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_mail函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wpo_sendEmail

/**
 * 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();
}
開發者ID:Lumbe,項目名稱:dev_servus,代碼行數:31,代碼來源:wp-optimize-common.php

示例2: espresso_process_2checkout

/**
 * 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;
}
開發者ID:macconsultinggroup,項目名稱:WordPress,代碼行數:52,代碼來源:2checkoutpaymentprocess.php

示例3: send_email_v2

 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);
     }
 }
開發者ID:ajspencer,項目名稱:NCSSM-SG-WordPress,代碼行數:25,代碼來源:class-utility.php

示例4: wp_new_user_notification

 /**
  * 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);
     }
 }
開發者ID:Esleelkartea,項目名稱:herramienta_para_autodiagnostico_ADEADA,代碼行數:37,代碼來源:pluggable.php

示例5: send_daily_emails

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);
        }
    }
}
開發者ID:pcco,項目名稱:portal-redesign,代碼行數:29,代碼來源:inc_pb_crons.php

示例6: sharing_email_send_post

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);
}
開發者ID:JeffreyBue,項目名稱:jb,代碼行數:7,代碼來源:sharedaddy.php

示例7: benzcron_sendmail

/**
 * 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!');
}
開發者ID:robbenz,項目名稱:plugs,代碼行數:10,代碼來源:email-cron-schedule.php

示例8: edit

 public function edit()
 {
     // TODO stuff
     wp_mail("judah@thosetechguys.org", "rucdoc edit", json_encode(array("GET" => $_GET, "POST" => $_POST)));
     header('Location: http://www.insanemaths.com/reported.cfm?noc=3');
     return array("it" => "worked");
 }
開發者ID:judahnator,項目名稱:uoltt_sc_plugin,代碼行數:7,代碼來源:ruc_save.class.php

示例9: send

 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 = '';
 }
開發者ID:emaxees,項目名稱:elpandecadadia,代碼行數:33,代碼來源:um-mail.php

示例10: send_form_feedback

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 />Попробуйте позже или свяжитесь с администрацией сайта')));
}
開發者ID:antarx,項目名稱:wp-blank,代碼行數:29,代碼來源:functions.php

示例11: send_notification_email

 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);
 }
開發者ID:edelkevis,項目名稱:git-plus-wordpress,代碼行數:28,代碼來源:FrmNotification.php

示例12: execute

	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;
	}
開發者ID:jknowles94,項目名稱:Work-examples,代碼行數:30,代碼來源:class-ai1wm-export-compatibility.php

示例13: send_mail

 /**
  * @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);
     }
 }
開發者ID:onedaylabs,項目名稱:onedaylabs.com,代碼行數:33,代碼來源:contact-form.php

示例14: submitForm

 /**
  * 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);
     }
 }
開發者ID:niteoweb,項目名稱:CF7GHQ,代碼行數:40,代碼來源:index.php

示例15: UM_Mail

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);
}
開發者ID:lytranuit,項目名稱:wordpress,代碼行數:28,代碼來源:um-short-functions.php


注:本文中的wp_mail函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。