WordPress.org

Ready to get started?Download WordPress

Forums

WP Better Emails
Setting the from in the header on a custom page doesn't work (6 posts)

  1. csmithny06
    Member
    Posted 1 year ago #

    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/

  2. hellonico
    Member
    Plugin Author

    Posted 1 year ago #

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

    Set the header to text/plain.

  3. csmithny06
    Member
    Posted 1 year ago #

    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.

  4. hellonico
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. csmithny06
    Member
    Posted 1 year ago #

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

  6. csmithny06
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic