Mail_Mime
| From: | Nadim Attari | Date: | Tue, 20 Jan 2004 11:37:33 +0000 |
| Subject: | Mail_Mime | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10239@lists.php.net to get a copy of this message | ||
Hello,
I'm new to PEAR... just installed it and trying some examples.
I copied the codes provides as is ... and it works !!! But the problem is
that it sends the mail 2 times !!!!
Can someone help me understanding this.
Thks
Nadim Attari
The code is below. Copied from
http://pear.php.net/manual/en/package.mail.mail-mime.example.php
====================================
<?php
include('Mail.php');include('Mail/mime.php');
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = '/home/richard/example.php';
$crlf = "\r\n";
$hdrs = array(
'From' => 'you@yourdomain.com',
'Subject' => 'Test mime message'
);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('postmaster@localhost', $hdrs, $body);
?>