I have been working on a project that needs to occasionally send off emails. If you need to do so, here’s how with wp_mail():
add_filter(‘wp_mail_content_type’,create_function(”, ‘return “text/html”; ‘));
wp_mail(‘firstname.lastname@example.org’, ‘Subject’, ‘Message’);
Thanks to WordPress Cheat Sheets for the code!
3 thoughts on “How to Send Emails in WordPress from the Functions.php”
Is it possible to send SMS through function.php using a SMS gateway API?
You can definitely setup an SMS interaction, but I would write your own function rather than call into the mail function. Then just hook it in to run when you need it to.
Thanks so much for this information Zack, I was trying to figure out how to change the email subject in a theme I’ve downloaded.
I also want to tell you that I’m a Treehouse member and really like your lessons and your teaching style.
Thanks for everything, I just discovered your blog and I’m going to be coming back.
Cheers from Argentina.