WordPress.org

Support

Support » Plugins and Hacks » WP Better Emails » Setting the from in the header on a custom page doesn't work

Setting the from in the header on a custom page doesn't work

  • I am trying to send a custom email using wp_mail function but it always shows as from the default email in the plugin configuration. Here is the code I am using to send the mail.

    $ToEmail = 'REMOVED';
    $EmailSubject = 'Depot Rquest';
    $mailheader[] = "From: ".$current_user->display_name." <".$current_user->user_email.">\r\n";
    $mailheader[] = "Reply-To: ".$current_user->display_name." <".$current_user->user_email.">\r\n";
    $mailheader[] = "Content-type: text/html; charset=iso-8859-1 \r\n";
    wp_mail( $ToEmail, $EmailSubject, $email_body, $mailheader );

    http://wordpress.org/extend/plugins/wp-better-emails/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author hellonico

    @nlemoine

    $mailheader[] = “Content-type: text/plain; charset=iso-8859-1 \r\n”;

    Set the header to text/plain.

    I just tried that I also changed the way the line is setup to
    $mailheader = "From: ".$current_user->display_name." <".$current_user->user_email.">\r\n Reply-To: ".$current_user->display_name." <".$current_user->user_email.">\r\n Content-type: text/plain; charset=iso-8859-1 \r\n";

    I also tried to just hard code in a from and reply address. Along with removing the reply address. I believe your plugin is the only one I use that has anything to do with emails. It still shows the sender and reply to the address I have set in the plugin.

    Plugin Author hellonico

    @nlemoine

    Sorry I read your message too fast and thought you had a template problem…

    Yes you’re right, my plugin is overriding the sender name and address when the fields are not blank.

    Is there a way around that? I really like your plugin but I need to be able to adjust those fields.

    I think I figured out away just not sure if this is the best way. I removed my email which is the same the site uses and name from your plugin. I then edited pluggable.php and change the $from_name= ‘WordPress’; to what I wanted. Now it works with the from/reply headers and I can still have my emails look great with your plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Setting the from in the header on a custom page doesn't work’ is closed to new replies.
Skip to toolbar