from: header in mail function

From: mark rose (mark_at_markrose_dot_speedfox_dot_net_at_foo.com)
Date: 07/07/04

  • Next message: Trevor Macdonald: "Calling a php function from Flash"
    Date: Tue, 06 Jul 2004 19:01:32 -0500
    
    

    I am having the hardest time sending a simple html email. For some reason
    my "From:" header gets chopped off, so all of my email are from 'null'.
    Below is some sample code and you can see the problem yourself at:

    markrose.speedfox.net/mail.php

    sample code
    ----------------

    <?php
    $m="";
    if ($_POST){
            $m = $_POST["email"];
            echo "Your email was sent to $m<p>"; }

    /* recipients */
    $to = $m;

    /* subject */
    $subject = "Birthday Reminders for August";

    /* message */
    $message = '
    <html>
    <head>
     <title>Birthday Reminders for August</title>
    </head>
    <body>
    <p>Here are the birthdays upcoming in August!</p>
    <table>
     <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
     </tr>
     <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
     </tr>
     <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
     </tr>
    </table>
    </body>
    </html>
    ';

    /* To send HTML mail, you can set the Content-type header. */

    $headers .= "From: Birthday Reminder <birthday@example.com>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\n";

    /* additional headers */

    /* and now mail it */
    mail($to, $subject, $message, $headers);
    echo "<p>$headers<p>";
    ?>

    <form action="mail.php" method="POST">
    <input type="Text" name="email" size="30" value="<?php echo $m;?>"><br>
    <input type="Submit" name="submit" value="send e-mail">
    </form>

    ##-----------------------------------------------##
             Article posted from PHP Freaks NewsGroups
             http://www.phpfreaks.com/newsgroups
             Get Addicted: php.general
    ##-----------------------------------------------##


  • Next message: Trevor Macdonald: "Calling a php function from Flash"

    Relevant Pages

    • Re: email a word doc with header and footer
      ... You'll need to send it as an attachment if you want the header and footer to ... HTML email is rather similar to the web. ... Word FAQ: http://www.word.mvps.org/ ...
      (microsoft.public.word.docmanagement)
    • Re: e-Mail word doc cuts page
      ... Is your masthead kept in the header or footer? ... To see roughly what your HTML email will look like before sending it, ... When using a masthead for instance, ...
      (microsoft.public.word.docmanagement)
    • Re: Unable to view images
      ... I have just published my first web site that uses a header!! ... when i send a html email that refereences pictures in say c:/website/images ... For testing purposes you can simply publish all contents of a site. ...
      (microsoft.public.isa.publishing)
    • Re: how can I stop sub total rows appearing in pivot tables in excel
      ... And to hide the subtotals programmatically, there's sample code here: ... You can also create a pivot table in Access, ... > If you rightclick on the button like header in your pivottable, ... >>I am working in excel and I need to prevent sub total rows appearing in my ...
      (microsoft.public.excel.misc)
    • Re: Adjusting margins of an email template
      ... > The header graphic is such that I need to adjust the margins so the ... find out how to create an html email with my email header in the email ... Glenn Reschke ...
      (microsoft.public.outlook.general)