문제

I am using php mail to send mail to all members in a message thread when a new reply is posted.

            include('Mail.php');
            include('Mail/mime.php');

            // Constructing the email
            $sender = "sender@sender.com";                              // Your name and email address
            //$to= "" ;                         // The Recipients name and email address
            $subject = $Sname." has posted a reply";                                            // Subject for the email

            $html = "<html><body><p> DearMember, <br>    $Sname has replied to one of your posts. </p></body></html>";  
            $crlf = "\n";
            $headers = array(
                            'From'          => $sender,
                            'Return-Path'   => $sender,
                            'Subject'       => $subject,
                            'Bcc'           => $recipients
                            );


            // Creating the Mime message
            $mime = new Mail_mime($crlf);

            // Setting the body of the email
            $mime->setTXTBody($text);
            $mime->setHTMLBody($html);

            $body = $mime->get();
            $headers = $mime->headers($headers);

            // Sending the email
            $mail =& Mail::factory('mail');
            $mail->send(null, $headers, $body);

Right now, I am addressing the recipient as "member". Is it possible to change that to individual usernames and still use the Bcc function?

도움이 되었습니까?

해결책

No, you cannot. You can either send the same message to all recipients using a long Bcc list, or you can send one personalized message to each user (calling mail() separately for each one), but there is no way to send a single email which differs for each recipient.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top