Sending Email With WP Mail SMTP


Using wp_mail() function to send email is just as easy as using the general PHP mail() function. The $to parameter indicates the intended recipients, $subject the message’s subject, and $message the message’s content. It is possible to use additional parameters like $headers to include extra information, if necessary. Generally, PHPMailer will add custom headers and attachments automatically.

While wp_mail() can handle most of these tasks, it still has some limitations. In particular, it uses PHPMailer by default, which provides useful preprocessing and workarounds for the wp_mail() function. In addition, mail() is simply too simple for complex tasks, such as handling UTF-8-encoded subject lines or email attachments. A comprehensive list of known issues and solutions can be found on the mailing list’s bug tracker. However, the main goal of wp_mail() is interoperability, not functionality.

The wp_mail() function sends an email to the specified address. The return value of this function is a string, but it can be an array if necessary. Note that the filter callbacks should be removed after using it. This is because they could conflict with system mail functions. You can also use wp_mail_content_type and wp_mail_charset to set the content type of the email.

WP Mail SMTP offers more advanced packages than the free version. The Pro Plan costs $49/year, while the Elite Plan includes a White Glove setup and priority support. For $199/year, you can use the Developer Plan, which includes a year of support, updates, and downloads. It’s also possible to get the agency plan, which offers everything from the developer plan to a free version.