• Resolved jkuruppu

    (@jkuruppu)


    just upgraded to 2.2; every time i upgrade, i have to add the “-f username@domain.com” into the mail command.

    i located the code for wp_mail in the pluggable.php file, but i can’t figure out where to put the -f switch. can anyone help me out? TIA

    here’s the code:

    if ( $headers == '' ) {
    		$headers = "MIME-Version: 1.0\n" .
    			"From: " . apply_filters('wp_mail_from', "wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']))) . "\n" .
    			"Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    	}

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    WordPress 2.2 no longer uses the mail command directly. Instead it uses the PHPMailer class, which handles all that sort of thing for you.

    Anyway, the default usage of PHPMailer actually does add the -f parameter, if a Sender is set.

    So look in the class-phpmailer.php file, and find this:

    /**
         * Sets the Sender email (Return-Path) of the message.  If not empty,
         * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
         * @var string
         */
        var $Sender            = "";

    Change that so that your Sender = “user@domain.com”.

    Thread Starter jkuruppu

    (@jkuruppu)

    Otto42 – you are a star!!!

    that was exactly what i needed to know, and now everything works.

    for those of you who are getting the following message that says:

    The e-mail could not be sent.
    Possible reason: your host may have disabled the mail() function…

    this might be the solution for you.

    i had contacted my ISP awhile ago, and was told that i had to have the -f switch set for their security systems to work and send email through PHP sendmail function. this now seems to be even easier than ever!!

    again, Otto42 – thanks!!

    Thx Otto42! that solved my problem too 😎

    Hello,

    I try it also but the field from will be allways empty. Doesn’t matter if I set it to sendmail, mail or smtp.

    Someone any idea?

    Thnx for the help.

    Greetings out of Munich
    Hans

    What other settings needs to done so an email will be sent to the moderator when somebody posts a comment? Does this work for internal blog too?

    Thanks.

    not working for me….

    I’m using wordpress 2.3.3

    This ALMOST works for me.

    If i put my email address in the area (as noted above) it does send mail BUT the reply page is blank (wp-comments-post.php)

    How do i fix that?

    Thanks

    Why don’t just add some little code in the class library that will automatically pick up the default email addess setting (it’s there, in the “from:” field, why not use the same one as “return-path:” ?

    The thing is, I have never figured out this happened, until some user started complaining that they did not receive lost password reset information… since their mail provider was dropping the mails as spam 🙁

    This is something that can be easily changed (so now I changed it and it fixes the issue), but… one will inevitably loose the change and have to do it again at every upgrade. Which I am not sure I will remember 🙁

    Thanks a lot,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘where to place -f switch in mail()’ is closed to new replies.