For built-in Wordpress functions such as the "forgot password" option, where is the SMTP server configured? Does it just default to the local daemon? What e-mail does it send messages as?


The default wp_mail() function is pluggable - meaning it can be entirely overridden by plugins. In the absence of any external influence, though, the "from" settings for the email address are hard-coded.

Here's a snippet from /wp-includes/pluggable.php:

// From email and name
// If we don't have a name from the input headers
if ( !isset( $from_name ) )
    $from_name = 'WordPress';

/* If we don't have an email from the input headers default to wordpress@$sitename
 * Some hosts will block outgoing mail from this address if it doesn't exist but
 * there's no easy alternative. Defaulting to admin_email might appear to be another
 * option but some hosts may refuse to relay mail from an unknown domain. See
 * http://trac.wordpress.org/ticket/5007.

if ( !isset( $from_email ) ) {
    // Get the site domain and get rid of www.
    $sitename = strtolower( $_SERVER['SERVER_NAME'] );
    if ( substr( $sitename, 0, 4 ) == 'www.' ) {
        $sitename = substr( $sitename, 4 );

    $from_email = 'wordpress@' . $sitename;

// Plugin authors can override the potentially troublesome default
$phpmailer->From     = apply_filters( 'wp_mail_from'     , $from_email );
$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name  );

I showed you this specific snippet for two reasons:

  1. It illustrates how the from name and email are set. By default mail is sent from "WordPress" using the address wordpress@sitename.url ... whatever sitename.url might be in your case.
  2. It shows that you can filter things a bit.

If you don't want to go the plugin route, you can set up a quick filter in your theme or in a drop-in MU plugin.

add_filter( 'wp_mail_from', 'wp44834_from' );
function wp44834_from( $from_email ) {
    return "myemail@mydomain.com";

add_filter( 'wp_mail_from_name', 'wp44834_from_name' );
function wp44834_from_name( $from_name ) {
    return "Bob";

These filters will override the built-in defaults and make it appear as if your email actually came from you rather than from WordPress.

| improve this answer | |

WordPress uses php mail by default. To use SMTP you'll need to use a separate plugin, of which there's several available - search WordPress.org and find one that fits your needs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.