[Plugin: WP-EMail] Specify custom Sender with Sendmail method (2 posts)

  1. oncletom
    Posted 6 years ago #


    I've setup WP-Email and tried to use it with Sendmail. However I looked inside the code and the $mail->Sender is never set.

    Could it been added in the options screen please? It would help to add the flag "-f" to mail/sendmail without hacking the code ;-)


  2. oncletom
    Posted 6 years ago #

    I hacked a bit the plugin to make this work as I wanted to:

    apply_filters('wp_email_send_pre', $mail, $post);
    // Send The Mail if($mail->Send()) {
    if($mail->Send()) {

    I added a filter before sending so I can deal how I want.
    Then I've plugged my hook on it:

    add_filter('wp_email_send_pre', 'wp_email_authsmtp_fix', 10, 2);
    function wp_email_authsmtp_fix($mail, $post)
      $email_smtp = get_option('email_smtp');
      foreach (array('yourname', 'youremail') as $arg)
        $$arg = isset($_POST[$arg]) ? strip_tags(stripslashes(trim($_POST[$arg]))) : '';
      $mail->AddReplyTo($youremail, $yourname);
      $mail->Sender = $mail->From = $email_smtp['username'];
      return $mail;

Topic Closed

This topic has been closed to new replies.

About this Topic