Codex tools: Log in / create account
Contents |
Sends an email.
<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>
<?php wp_mail('me@example.net', 'The subject', 'The message'); ?>
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.
A true return value does not automatically mean that the user received the email successfully.
For this function to work, you need the following:SMTP and smtp_port need to be set in your php.inisendmail_from setting in php.ini, or pass it as an additional header like so:
<?php
$headers = 'From: My Name <myname@mydomain.com>' . "\r\n\\";
wp_mail('test@test.com', 'subject', 'message', $headers);
?>