Last active
July 8, 2024 15:19
-
-
Save bordoni/8731880 to your computer and use it in GitHub Desktop.
How to Send an Email via WordPress | Article on Sending emails on WordPress -- http://bordoni.me/wordpress/send-wordpress-email/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$to = "[email protected]"; | |
$subject = "Learning how to send an Email in WordPress"; | |
$content = "WordPress knowledge"; | |
$headers = [ | |
'Reply-To' => "Gustavo Bordoni <[email protected]>" | |
]; | |
$status = wp_mail( $to, $subject, $content, $headers ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$to = "[email protected]"; | |
$subject = "Learning how to send an Email in WordPress"; | |
$content = "WordPress <b>knowledge<b>"; | |
$set_content_type_callback = static function () { | |
return 'text/html'; | |
}; | |
add_filter( 'wp_mail_content_type', $set_content_type_callback ); | |
$status = wp_mail( $to, $subject, $content ); | |
// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578 | |
remove_filter( 'wp_mail_content_type', $set_content_type_callback ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$to = [ | |
"Gustavo Bordoni <[email protected]>", | |
"WordPress Developer <[email protected]>", | |
"[email protected]" | |
]; | |
$subject = "Learning how to send an Email in WordPress"; | |
$content = "WordPress knowledge"; | |
$status = wp_mail( $to, $subject, $content ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$to = "[email protected]"; | |
$subject = "Learning how to send an Email in WordPress"; | |
$content = "WordPress knowledge"; | |
$status = wp_mail( $to, $subject, $content ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Helpful info.. Thanks