Re: Mail and Mail/Mime, Hidding To field like BCC?
| From: | Ian Warner | Date: | Thu, 15 Feb 2007 08:45:32 +0000 |
| Subject: | Re: Mail and Mail/Mime, Hidding To field like BCC? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-26585@lists.php.net to get a copy of this message | ||
Louie Miranda wrote:
How would i hide the "To" field? Like a bcc? This code does not hide it? Please help!The code is Bcc and if my memory serves me the header order is important ?? Otherwise if that doesnt work simply send another mail to the 3rd party - ie $mail->send('bccrecipient@example.com', $hdrs, $body); you should also set the date in your headers with $headers['Date'] = date(DATE_RFC2822); -- PHP5 and utilise 'Someones Name <someone@example.com>' Actually thinking about it I dont know whether PHP Mail has Bcc support again memory ?? - try sending via your SMTP server and test that first $params['host'] = 'smtp.domain.com'; // For SMTP Auth $params['auth'] = true; $params['username'] = 'user'; $params['password'] = 'pass'; // Create the mail object using the Mail::factory method $mail =& Mail::factory('smtp', $params);
<?php
include('Mail.php');
include('Mail/mime.php');
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = 'test1.php';
$crlf = "\n";
$hdrs = array(
'To' => 'someone@example.com',
'From' => 'you@yourdomain.com',
'Subject' => 'Test mime message'
);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');
//do not ever try to call these lines in reverse order
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('lmiranda@example.com', $hdrs, $body);
echo "sent!";
?>
Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s