PHP Email Help

Out of context: Reply #4

  • Started
  • Last post
  • 9 Responses
  • vaxorcist0

    It seems headers are the defined way.... various ways to code this... but it should be easy to convert the other code to "header-style" code, you can use arrays or concatenated strings....

    <?php
    $headers = array();
    $headers[] = "MIME-Version: 1.0";
    $headers[] = "Content-type: text/plain; charset=iso-8859-1";
    $headers[] = "From: Sender Name <
    $headers[] = "Bcc: JJ Chong <
    $headers[] = "Reply-To: Recipient Name <
    $headers[] = "Subject: {$subject}";
    $headers[] = "X-Mailer: PHP/".phpversion();

    mail($to, $subject, $email, implode("\r\n", $headers));
    ?>

    • without the ugly, vurnable \r\n hard-coded windows/unix return characters that are so problematic in above example...vaxorcist

View thread