Re: Mail - only send to Bcc
| From: | Dan Rossi | Date: | Fri, 22 Apr 2005 11:10:43 +0000 |
| Subject: | Re: Mail - only send to Bcc | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18911@lists.php.net to get a copy of this message | ||
try sending it to yourself in the to header ?
On 22/04/2005, at 8:46 PM, Alexander Petri wrote:
Hi
i tried the following code send mails only toBccs
but they are all in the 'To' header
how could i set them in 'Bcc' ?
what about "nonworking" emailadresses in a large array
are there any expiriences
here is my code:
define(LANG,"de");
require_once '../ini/config.php';
$headers['Subject'] = "Text in der Betreffzeile";
$headers['From'] = "info@my-domain.de";
$headers['Bcc'] = array( "jon.doe@gmx.de",
"test@test.de",
"de@de.de",
"bla@blubb.com");
// text
$text = "asdasd asdasd adsasd \n";
$text.= "Link klicken: \n\n";
$text.= 'http://www.gmx.de';
if(sendMail($text,$headers)){
echo "Mailing hat geklappt";
}else{
echo "Mailing fehlgeschlagen";
}
// sendmail fkt
function sendMail($text,$hdrs,$crlf="\n"){
require_once('Mail.php');
require_once('Mail/mime.php');
$html = parseHtml($text);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
return $mail->send($hdrs['Bcc'], $hdrs, $body);
}
//HTML Parse fkt
function parseHtml($text){
$pre="<span style=\"font-family:Arial, Helvetica, sans-serif \">";
$suff="</span>";
$text_arr = explode (" ", $text);
foreach($text_arr as $k => $v){
if(substr_count($v,"http://")==1){
$text_arr[$k]='<a href="'.$v.'" >'.$v.'</a><br>';
}else{
$text_arr[$k]=nl2br($v);
}
}
$text = $pre.implode(" ", $text_arr).$suff;
return $text;
}
-- PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php