How to Send Emails in WordPress from the Functions.php

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(‘whoever@whatever.com’, ‘Subject’, ‘Message’);

Thanks to WordPress Cheat Sheets for the code!

3 thoughts on “How to Send Emails in WordPress from the Functions.php

    1. Zac Gordon Post author

      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.

      Like

      Reply
  1. Exequiel

    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.

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s