wp_mail


wp_mail ( $to, $subject, $message, $headers = '', $attachments = array() )

Parameters:
  • (string|array) $to Array or comma-separated list of email addresses to send message.
  • (string) $subject Email subject
  • (string) $message Message contents
  • (string|array) $headers Optional. Additional headers.
  • (string|array) $attachments Optional. Files to attach.
Returns:
  • (bool) Whether the email contents were sent successfully.
Defined at:

Description

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 email@address.com' when both are set. If just 'wp_mail_from' is set, then just the email address will be used with no 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 {@see 'wp_mail_content_type'} filter.

The default charset is based on the charset used on the blog. The charset can be set using the {@see 'wp_mail_charset'} filter.

Related Functions

wp_salt, wp_meta, wp_title, is_email, wp_is_mobile

Top Google Results

User discussions

wpseek mobile