php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15957 HTML-code and header in mail message
Submitted: 2002-03-08 08:13 UTC Modified: 2002-03-08 08:27 UTC
From: richard at nmw dot nl Assigned:
Status: Not a bug Package: *Mail Related
PHP Version: 4.1.2 OS: RedHat Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: richard at nmw dot nl
New email:
PHP Version: OS:

 

 [2002-03-08 08:13 UTC] richard at nmw dot nl
If I use the mail function of PHP 4.1.2 and I use the following code:

==========================================================
<?
/* recipients */
$to  = "Richard <richard@nmw.nl>"; //note the comma

/* subject */
$subject = "HTML Testmail ";

/* message */
$message = '
<html>
<head>
 <title>HTML Testmail</title>
</head>
<body>
<p>HTML Testmail</p>
<table>
 <tr>
  <th>ID</th><th>Voornaam</th><th>Achternaam</th><th>Year</th>
 </tr>
 <tr>
  <td>1</td><td>Richard</td><td>Sterken</td><td>1970</td>
  <td>2</td><td>Danny</td><td>Dam Wichers</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: Mailer Daemon <mailerdaemon@nmw.nl>\r\n";


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

I recieve a mail like this:


==========================================================
Content-type: text/html; charset=iso-8859-1
From: Mailer Daemon <mailerdaemon@nmw.nl>



<html>
<head>
 <title>HTML Testmail</title>
</head>
<body>
<p>HTML Testmail</p>
<table>
 <tr>
  <th>ID</th><th>Voornaam</th><th>Achternaam</th><th>Year</th>
 </tr>
 <tr>
  <td>1</td><td>Richard</td><td>Sterken</td><td>1970</td>
  <td>2</td><td>Danny</td><td>Dam Wichers</td><td>1973</td>
 </tr>
</table>
</body>
</html>
==========================================================


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-08 08:15 UTC] richard at nmw dot nl
Unfortunately I've got no gdb backtrace.
 [2002-03-08 08:21 UTC] mfischer@php.net
Backtrace from what? 

This is a support question and best asked on php-general@lists.php.net until I missed some very important information you didn't mentioned at this point ... ?

Bogusifying.
 [2002-03-08 08:27 UTC] richard at nmw dot nl
Never mind!
 [2002-09-21 18:07 UTC] chad at liebermanconsulting dot com
Funny, I have the same problem.  However, in my case, I only see the headers in the body of my emails when I am sending email to a domain residing on the same server as where the mail is being sent from.  When i sent mail using PHP to a remote address the headers are fine.  This is in 4.2.2...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC