Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: mail() help

  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts

    mail() help

    My script
    PHP Code:
    <?php
    $yourname 
    $_POST['yourname'];
    $yourmail $_POST['yourmail'];
    $friendname $_POST['friendname'];
    $friendmail $_POST['friendmail'];
    $subject "Site Recommendation from $yourname";
    $mailheader "From: $yourmail\n";
    $mailheader .= "Reply-To: $yourmail\n\n";
    $message "Hi, $friendname! $yourname has recommended <a href=\"http:\\www.net-riches.com\">Net-Riches.com</a> for you to see. You can do so by clicking <a href=\"http:\\www.net-riches.com\">here</a>\n\nThank You!";
    mail($friendmail,$subject,$message,$mailheader) or die("Failure!");
    echo 
    "Thanks!";
    echo 
    "<hr noshade color=\"black\" size=\"1\">";
    echo 
    "Here is what you sent :";
    echo 
    "From $yourname @ $yourmail";
    echo 
    "<br>";
    echo 
    "To $friendname @ $friendmail";
    echo 
    "<br>";
    echo 
    $message;
    ?>
    Is mailing properly except for one thing, the message is howing with <a href="http://www.net-riches.com">Net-Riches.com</a> instead of Net-Riches.com Is there a reason why?

    Thanks
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    becuase you haven't set any kind of content type... the system assumes it is plain text without the Content-Type: header.

    try adding:

    Content-type: text/html;

    as one of the headers. I may be slightly off but i think its something along those lines.

  • #3
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <?php
    $yourname 
    $_POST['yourname'];
    $yourmail $_POST['yourmail'];
    $friendname $_POST['friendname'];
    $friendmail $_POST['friendemail'];
    $subject "Site Recommendation from $yourname";
    $mailheader "From: $yourmail\n";
    $mailheader .= "Reply-To: $yourmail\n\n";
    $mailheader .= "Content-Type: text/html";
    $message "Hi, $friendname! $yourname has recommended <a href=\"http:\\www.net-riches.com\">Net-Riches.com</a> for you to see. You can do so by clicking <a href=\"http:\\www.net-riches.com\">here</a>\n\nThank You!";
    mail($friendmail,$subject,$message,$mailheader) or die("Failure!");
    echo 
    "Thanks!";
    echo 
    "<hr noshade color=\"black\" size=\"1\">";
    echo 
    "Here is what you sent :";
    echo 
    "From $yourname @ $yourmail";
    echo 
    "<br>";
    echo 
    "To $friendname @ $friendmail";
    echo 
    "<br>";
    echo 
    $message;
    ?>
    Sounded reasonable, but It just displays Content-Type: text/html in the message body......
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    MIME-Version: 1.0\r\n
    Content-Type: multipart/alternative;

    that also rings a bell, try that

    i seem to remember something to do with a boundry... ill try find out

  • #5
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <?php
    $yourname 
    $_POST['yourname'];
    $yourmail $_POST['yourmail'];
    $friendname $_POST['friendname'];
    $friendmail $_POST['friendemail'];
    $subject "Site Recommendation from $yourname";
    $mailheader "From: $yourmail\n";
    $mailheader .= "Reply-To: $yourmail\n\n";
    /*The three below right here just show up in the message body*/
    $mailheader .= "MIME-Version: 1.0\r\n";
    $mailheader .= "Content-Type: multipart/alternative";
    $mailheader .= "Content-Type: text/html";
    $message "Hi, $friendname! $yourname has recommended <a href=\"http:\\[url]www.net-riches.com\[/url]">Net-Riches.com</a> for you to seeYou can do so by clicking <a href="http:\\[url]www.net-riches.com\[/url]">here</a>nnThank You!";
    mail($friendmail,$subject,$message,$mailheader) or die("
    Failure!");
    echo "
    Thanks!";
    echo "
    <hr noshade color="black\" size=\"1\">";
    echo 
    "Here is what you sent :";
    echo 
    "From $yourname @ $yourmail";
    echo 
    "<br>";
    echo 
    "To $friendname @ $friendmail";
    echo 
    "<br>";
    echo 
    $message;
    ?>
    Read my comments
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if i have got it right:

    PHP Code:

    $mailheader 
    "From: $yourmail\n";
    $mailheader .= "Reply-To: $yourmail\n";
    $mailheader .= "MIME-Version: 1.0\n";
    $mailheader .= "Content-Type: multipart/alternative\n";
    $mailheader .= "Content-Type: text/html\n";
    // need \n at the end of each line 

  • #7
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope, doesnt work........
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #8
    New Coder
    Join Date
    Jul 2003
    Location
    Mexico City
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    from php.net:

    PHP Code:
    <?php
    /* recipients */
    $to  "Mary <mary@example.com>" ", " // note the comma
    $to .= "Kelly <kelly@example.com>";

    /* 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  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    /* additional headers */
    $headers .= "From: Birthday Reminder <birthday@example.com>\r\n";

    $headers .= "Cc: [email]birthdayarchive@example.com[/email]\r\n";
    $headers .= "Bcc: [email]birthdaycheck@example.com[/email]\r\n";

    /* and now mail it */
    mail($to$subject$message$headers);
    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •