• Resolved edwardsmark

    (@edwardsmark)


    has anybody successfully used /usr/bin/s-nail to send mail from wp_mail()?

    google-AI suggested an interesting but LONG add_filter() but i had hoped for an easier way.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Yui

    (@fierevere)

    永子

    You can modify your php.ini as follows:

    sendmail_path = "/usr/bin/s-nail -t"
    Thread Starter edwardsmark

    (@edwardsmark)

    ok i am a LOT further along, still need to debug a little bit:


    <?php
    $message = "Content-Type :text/html\n\nLine one \nLine two";
    $message = wordwrap($mesage, 70, "\r\n";
    mail('mark@mark.com', 'test subject', $message);

    gives:

    s-nail: SMTP server: 555-5.5.2 Syntax error, cannot decode response. For more information, go to
    s-nail: SMTP server: 555-5.5.2 https://support.google.com/a/answer/3221692 and review RFC 5321
    s-nail: SMTP server: 555 5.5.2 specifications. d75a77b69052e-51c30c35b22sm20109691cf.20 - gsmtp
    /root/dead.letter 15/381
    s-nail: … message not sent
    PHP Warning: mail(): Sendmail exited with non-zero exit code 4 in /root/mail2.php on line 9

    i am working on this inbetween appointments.

    • This reply was modified 1 week, 1 day ago by edwardsmark.
    • This reply was modified 1 week, 1 day ago by edwardsmark.
    • This reply was modified 1 week, 1 day ago by edwardsmark.
    • This reply was modified 1 week, 1 day ago by edwardsmark.
    Thread Starter edwardsmark

    (@edwardsmark)

    darn…. its a php error, going to try to find a php forum…..

    Thread Starter edwardsmark

    (@edwardsmark)

    to spare somebody the hours of trouble:

    sendmail_path = "tr --delete '\r' | /usr/bin/s-nail -t"
    php -r 'mail("mark@mark.com", "Test Subject", "this is a test line");'

    Thread Starter edwardsmark

    (@edwardsmark)

    working test script below was written from this excellent example.


    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    // include wordpress
    require_once('wp-load.php');
    $to = "mark@mark.com";
    $msg = "test email via wordpress";

    $headers = array(
    'From: server<info@myserver.com>'
    );
    $headers = implode( PHP_EOL, $headers );
    // use wordpress email function
    $check = wp_mail($to, $msg, $msg, $headers);

    var_dump($check);
Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.