WordPress.org

Forums

sendmail ok from command line, not from WP (3 posts)

  1. deadbird
    Member
    Posted 2 years ago #

    Hi.
    Almost everything's in the title: I successfuly send mail from command line using something as echo "test message" | mail -s "test message" email@gmail.com, but WP can't send anything at all :'(
    I created a phpinfo page, here's what I got:
    mail.add_x_header On On
    mail.force_extra_parameters no value no value
    mail.log no value no value

    sendmail_from no value no value

    (is it necessary?)

    sendmail_path /usr/sbin/sendmail /usr/sbin/sendmail

    (this is the correct path)

    Path to sendmail /usr/sbin/sendmail

    (correct again)

    Please help :'(

  2. deadbird
    Member
    Posted 2 years ago #

    More: I set "sendmail_from", no change. I emptied /var/log/exim4/mainlog, tried to send a mail from WP, checked log: it's still empty :'(

  3. deadbird
    Member
    Posted 2 years ago #

    News: I tested phpmailer class used by WP with this:

    <?php
    include "./wp-includes/class-phpmailer.php";
    $mail = new PHPMailer();
    $mail->IsMail();

    $mail->AddAddress("deadbird99@gmail.com");
    $mail->Subject = "Test 1";
    $mail->Body = "Test 1 of PHPMailer.";

    if(!$mail->Send())
    {
    echo "Error sending: " . $mail->ErrorInfo;;
    }
    else
    {
    echo "Letter sent";
    }
    ?>

    It works perfectly! What the heck?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags