wp_mail function use to Sending Emails using PHP wordpress – PHP wordpress makes use of wp_mail() function to send an email. wordpress mail is the built in wordpress function that is used to send emails from wordpress scripts.
wp_mail – The wp_mail() Function in WordPress
wordpress wp_mail() Function close to core PHP’s mail function. The wp_mail() function accepts the following Syntax:
wp_mail Send mail : Syntax
wp_mail( string|array $to, string $subject, string $message, string|array $headers = '', string|array $attachments = array() )
use of wp_mail() – Sends an email
wp_mail( $to, $subject, $message, $headers, $attachments );
Example
$to = '[email protected]'; $subject = 'Welcome To Pakainfo.com'; $body = 'Pakainfo website focuses on all web language and framework tutorial PHP, Laravel, Codeigniter, Nodejs, API, git, MySQL, AJAX, jQuery, CSS, JavaScript, Demo'; $headers = array('Content-Type: text/html; charset=UTF-8'); wp_mail( $to, $subject, $body, $headers );
don’t miss : PHP Check If mail() function is enable
Wp_mail wordpress example
Example – How to use wp_mail() function in wordpress?
array('Content-Type' => 'application/json; charset=utf-8'), 'body' => json_encode($data, true), 'method' => "POST", 'data_format' => 'body', )); if( is_wp_error( $request ) ) { $error_string = $request->get_error_message(); $response_headers = wp_remote_retrieve_headers( $request ); $body = wp_remote_retrieve_body( $request ); $to = APP_NOTIFICATION_EMAIL; $subject = 'SEND-INFO: Server Error has occurred : from '.APP_BASE_URL.' - Online Application'; $message = '
Hello Dear,
|
I hope you get an idea about How to send e-mail in WordPress.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.