Support » Developing with WordPress » default mail is sent from “WordPress” using the address wordpress@sitename.url

  • Resolved apolloman

    (@apolloman)


    good day dear wordpress-experts,

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

    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 posted this specific snippet for two reasons:

    – 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 our case.
    It shows that we can filter things a bit.

    note: this information is derived from an earlier insight:

    Question; does wordpress use by default the adress: address wordpress@sitename.url

    in other words: I am not sure is this still truely the fact that wordpress is using “WordPress” using the address wordpress@sitename.url

    • This topic was modified 1 year, 10 months ago by  apolloman.
Viewing 1 replies (of 1 total)
  • Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    This is a nice topic for your blog, but it’s not a topic for the support forums.

Viewing 1 replies (of 1 total)
  • The topic ‘default mail is sent from “WordPress” using the address wordpress@sitename.url’ is closed to new replies.