from: header in mail function
From: mark rose (mark_at_markrose_dot_speedfox_dot_net_at_foo.com)
Date: 07/07/04
- Previous message: Piotr Usewicz: "Re: No access to php.ini"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
##-----------------------------------------------##
- Previous message: Piotr Usewicz: "Re: No access to php.ini"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|