Bug #10031 [Fbk->Bgs]: sending emails with hmtl body doesn't work
| From: | mj@php.net | Date: | Sun, 11 Mar 2007 10:14:50 +0000 |
| Subject: | Bug #10031 [Fbk->Bgs]: sending emails with hmtl body doesn't work | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-9508@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=10031&edit=1
ID: 10031
Updated by: mj@php.net
Reported By: yvettesio at yahoo dot com
Summary: sending emails with hmtl body doesn't work
-Status: Feedback
+Status: Bogus
Type: Bug
Package: Documentation
Operating System: windows XP
PHP Version: 4.4.2
-Assigned To:
+Assigned To: mj
New Comment:
Yvette,
the code you have provided works great for me, so I don't think there
is a bug in Mail_mime. But you must really make sure that you validate
$_POST['f_email'] before passing it to Mail_mime as the receiver.
Otherwise someone could easily use your system to spam thousands of
people at a time etc.
I'm now going to mark this report as bogus, because the problem seems
to be somewhere in your own code. If you still feel the bug is on our
side, please point us to the concrete place where you think something
is wrong, and re-open this bug.
Thank you!
- Martin
Previous Comments:
------------------------------------------------------------------------
[2007-02-14 04:46:35] mj at php dot net
Setting state to "Feedback".
------------------------------------------------------------------------
[2007-02-05 20:59:53] davidc at php dot net
let me guess, this script prints the email that was suposed to be
sent..
include $theme_dir."theme_email_friend.php";
Also try this :
$sent = $mail->send(...);
if (PEAR::isError($sent)) {
print_r($sent);
die();
}
------------------------------------------------------------------------
[2007-02-05 20:54:30] yvettesio at yahoo dot com
Description:
------------
Hi I am using PEAR 1.4.11 package i tried using mail mime class to send
html messages to emails but it didn't work
Test script:
---------------
<?php
if($_POST['send']){
include($lib_dir.'PEAR/Mail.php');
include($lib_dir.'PEAR/Mail/mime.php');
$html = '<html><body>HTML version of email</body></html>';
$crlf = "\n";
$hdrs = array(
'From' => $_POST['y_email'],
'Subject' => 'Check this Site'
);
$mime = new Mail_mime($crlf);
$mime->setHTMLBody($html);
//do not ever try to call these lines in reverse order
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send($_POST['f_email'], $hdrs, $body);
}
include $theme_dir."theme_email_friend.php";
?>
Expected result:
----------------
it should have been sent through my email
Actual result:
--------------
it printed the html code and stop running the rest of the script. it
shouldn't have been printed but send to the email address immediately
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=10031&edit=1