Send mail, similar to PHP’s mail
A true return value does not automatically mean that the user received the email successfully. It just only means that the method used was able to process the request without any errors.
Using the two ‘wp_mail_from’ and ‘wp_mail_from_name’ hooks allow from creating a from address like ‘Name
The default content type is ‘text/plain’ which does not allow using HTML. However, you can set the content type of the email by using the ‘wp_mail_content_type’ filter.
The default charset is based on the charset used on the blog. The charset can be set using the ‘wp_mail_charset’ filter.
Signature
wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )
- to
- (string|array) Array or comma-separated list of email addresses to send message.
- subject
- (string) Email subject
- message
- (string) Message contents
- headers
- (string|array) Optional. Additional headers.
Default:'' - attachments
- (string|array) Optional. Files to attach.
Default:array()
Return
(boolean) Whether the email contents were sent successfully.
Source
WP Trac GitHub Bitbucketfunction wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { // Compact the input, apply the filters, and extract them back out extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) ); if ( !is_array($attachments) ) $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) ); global $phpmailer; // (Re)create it, if it's gone missing if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer( true ); } // Headers if ( empty( $headers ) ) { $headers = array(); } else {224 more lines...
Link here
-
URL
http://queryposts.com/function/wp_mail/ -
HTML
<a href='http://queryposts.com/function/wp_mail/'>wp_mail()</a> -
Markdown
[wp_mail()](http://queryposts.com/function/wp_mail/) -
BBCode
[url=http://queryposts.com/function/wp_mail/]wp_mail()[/url]