• My client wants to be able to edit the email headers, so I added an edit page for this, and added them as options, but the emails have stopped sending now.

    The previous (and working) format was this:

    $headers = 'From: LoadPress <[email protected]>' . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    But when I added the option to it:

    $headersF = 'From: LoadPress <[email protected]>' . "\r\n";
    	$headers = 'From: '.get_option('LoadPressEmailEditor_FromValue', $headersF)."\r\n";
    	$headers .= "MIME-Version: 1.0\r\n";
    	$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    It stopped working, and no email is sent now.

    Any ideas as to what I have done?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    what is that get_option supposed to be doing? What value to you get from it?

    Try adding a “print_r($headers)” before you call the mail function

    Thread Starter kjgbriggs

    (@kjgbriggs)

    get_option is part of the WordPress API, it retrieves saved “options” (the things you get in settings for example) from the WP DB (if they exist).

    The one I have set up there for example retrieves the letter A.

    I previously had ‘From: LoadPress <[email protected]>’ . “\r\n” which worked fine, but the client wants to have it so they can change it at will using the editor I have built.

    The problem is (I think (wild stab in the dark really)) that it doesn’t have any of the correct formatting (probably wrong).

    So, I’m not sure at all what is wrong really (oh if I had a penny…).

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I know what get_option does, i’m asking whether you[‘re using it correctly.

    thus, do a print_r of the return to see if you get what you expect.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Correctly formatting wp_Mail's $headers from an input’ is closed to new replies.