elektron pochta xabarlari phpemailer bilan bir necha bor yuborilgan

Phpemailer-dan serverdan elektron pochta xabarlarini yuborish uchun foydalanishga harakat qilaman. U bir narsadan tashqari ishlaydi:

<?php

$serverName = "xxx.x.x.xxx"; //serverName\instanceName
$connectionInfo = array( "Database"=>"test", "UID"=>"xxxxxx", "PWD"=>"xxxxxx");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.
"; }else{ echo "Connection could not be established.
"; die( print_r( sqlsrv_errors(), true)); } $sqll=sqlsrv_query($conn,"select bla from table"); //while($row=sqlsrv_fetch_array($sql)) // { // $cnp=substr($row['bla'],-6); // echo $bla; // echo "
"; // } $con=mysqli_connect("localhost","root","","database"); $sql=mysqli_query($con,"select * from table"); if(isset($_POST['submitted'])){ require 'phpmailer/PHPMailerAutoload.php'; //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 2; $mail->SMTPAuth = true; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = "xxxxxx"; //Set the SMTP port number - likely to be 25, 465 or 587 $mail->Port = xxx; $mail->SMTPSecure = 'ssl'; //Whether to use SMTP authentication $mail->SMTPAuth = true; //Username to use for SMTP authentication $mail->Username = "xxxxxx"; //Password to use for SMTP authentication $mail->Password = "xxxxxx"; //Set who the message is to be sent from $mail->setFrom('xxxxxx'); //Set an alternative reply-to address $mail->addReplyTo('xxxxxx'); //Set who the message is to be sent to while($row=mysqli_fetch_array($sql)) { echo $row['bla']; echo "
"; $mail->AddBCC($row['bla2']); //Set the subject line $mail->Subject = 'text text'; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body //Replace the plain text body with one created manually $mail->Body = "test test
link:click"; $mail->IsHTML(true); $mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } } } ?> <form name="contact" method="post" action=""> <input type="submit" name="submitted" value="Submit"> </form>

Muammo shundaki, men o'z ma'lumotlar bazamda mavjud bo'lgan har bir e-pochtaga boshqa elektron manzilni yuborishni xohlayman. Men bu qismni vaqt oralig'ida qo'ydim:

$mail->AddBCC($row['email']);



//Set the subject line
$mail->Subject = 'text text';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body

//Replace the plain text body with one created manually
$mail->Body = "test test
link:click"; $mail->IsHTML(true); $mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } }

E-pochtalar yuborilmoqda, lekin mening masamda 3 elektron pochta manzilim bo'lsa, masalan, e-mail1 ga 3 marta elektron pochta orqali yuboriladi, 2 marta e-mailga yuboriladi va email3 bir marta yuboriladi. Nima sababdan? nima uchun elektron pochtam mening jadvalimdagi birinchi elektron pochtaga 3 marta yuborilgan?

1
Bu mening localhost server xamppdan faqat qo'g'irchoq ma'lumotlar.
qo'shib qo'ydi muallif user1147188, manba
Bu mening localhost server xamppdan faqat qo'g'irchoq ma'lumotlar.
qo'shib qo'ydi muallif user1147188, manba
Ha ... BCC juda muhim
qo'shib qo'ydi muallif user1147188, manba
Ha ... BCC juda muhim
qo'shib qo'ydi muallif user1147188, manba
@DrKey Id 'bu erda juda muhimdir.
qo'shib qo'ydi muallif Scuzzy, manba
@DrKey Id 'bu erda juda muhimdir.
qo'shib qo'ydi muallif Scuzzy, manba
$ mail-> addBCC() o'rniga $ mail-> setAddress ($ row ["email"])
qo'shib qo'ydi muallif DrKey, manba
$ mail-> addBCC() o'rniga $ mail-> setAddress ($ row ["email"])
qo'shib qo'ydi muallif DrKey, manba
Bu sizning savolingizga javob bermaydi, lekin yuqoridagi skriptga kiritilgan haqiqiy pochta hisobingiz ma'lumotlarini ayting. Va nima uchun siz mening SQL Server va MySQL bilan bog'lanasiz?
qo'shib qo'ydi muallif Lucas Krupinski, manba

6 javoblar

E-pochtani yuborganimdan so'ng quyidagi qatorni qo'shdim:

$mail->ClearAllRecipients();

Va endi elektron pochtalar yuborilgan bir marta yuborilgan. Barchangizga rahmat!

0
qo'shib qo'ydi

E-pochtani yuborganimdan so'ng quyidagi qatorni qo'shdim:

$mail->ClearAllRecipients();

Va endi elektron pochtalar yuborilgan bir marta yuborilgan. Barchangizga rahmat!

0
qo'shib qo'ydi

call $mail->ClearBCCs() after $mail->send()

BCC-qatoriga tayinlangan barcha foydalanuvchilarni o'chiradi. Voidni qaytaradi.

- ...

Move your $mail->send() to after the loop to send all BCC addressed emails at once. (you may need to do this in batches depending on the mail server)

0
qo'shib qo'ydi

call $mail->ClearBCCs() after $mail->send()

BCC-qatoriga tayinlangan barcha foydalanuvchilarni o'chiradi. Voidni qaytaradi.

- ...

Move your $mail->send() to after the loop to send all BCC addressed emails at once. (you may need to do this in batches depending on the mail server)

0
qo'shib qo'ydi

Menimcha, muammo siz BCCga elektron pochta xabarlarini qo'shayotganingizdir, shuning uchun birinchi davrada siz uni birinchi elektron pochtaga yuborasiz, ikkinchidan, siz birinchi e-pochtaga yuborasiz va yangi qo'shilgan ikkinchi elektron pochta manzilini , va hokazo...

Yangi e-pochta xabarini yuborishdan oldin maxfiylikni tozalash kerak.

0
qo'shib qo'ydi

Menimcha, muammo siz BCCga elektron pochta xabarlarini qo'shayotganingizdir, shuning uchun birinchi davrada siz uni birinchi elektron pochtaga yuborasiz, ikkinchidan, siz birinchi e-pochtaga yuborasiz va yangi qo'shilgan ikkinchi elektron pochta manzilini , va hokazo...

Yangi e-pochta xabarini yuborishdan oldin maxfiylikni tozalash kerak.

0
qo'shib qo'ydi
PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin