Кемеровские программисты php общаются здесь
Anonymous
PHP Mailer по электронной почте с тем же отправителем, получателем и предметом не заходите в одну ветку электронной почт
Сообщение
Anonymous » 08 фев 2025, 12:21
Пожалуйста, изображение ниже. Отправитель - один и тот же тема, тот же адрес электронной почты, который отправитель одинаковы, но они всегда входят в отдельную электронную почту, а не в одном потоке электронной почты, как и должно. Скрипт. < /p>
Код: Выделить всё
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader
require 'vendor/autoload.php';
function send_mail($to,$subject,$body,$from = '', $host = "support@sensored.com"){
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'mail.privateemail.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'support@sensored.com'; //SMTP username
$mail->Password = 'xxxxx'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom($host, $from);
// $mail->addAddress($to, 'Subscriber'); //Add a recipient
$mail->addAddress($to); //Name is optional
// $mail->addReplyTo('support@sensored.com', 'Sensored Support');
//$mail->addCC('cc@example.com');
$mail->addBCC('sensored@gmail.com');
//Attachments
// $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
// $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
//$mail->AltBody = ' ';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
Подробнее здесь:
https://stackoverflow.com/questions/794 ... into-one-e
1739006499
Anonymous
Пожалуйста, изображение ниже. Отправитель - один и тот же тема, тот же адрес электронной почты, который отправитель одинаковы, но они всегда входят в отдельную электронную почту, а не в одном потоке электронной почты, как и должно. Скрипт. < /p> [code]use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; //Load Composer's autoloader require 'vendor/autoload.php'; function send_mail($to,$subject,$body,$from = '', $host = "support@sensored.com"){ //Create an instance; passing `true` enables exceptions $mail = new PHPMailer(true); try { //Server settings // $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'mail.privateemail.com'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'support@sensored.com'; //SMTP username $mail->Password = 'xxxxx'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom($host, $from); // $mail->addAddress($to, 'Subscriber'); //Add a recipient $mail->addAddress($to); //Name is optional // $mail->addReplyTo('support@sensored.com', 'Sensored Support'); //$mail->addCC('cc@example.com'); $mail->addBCC('sensored@gmail.com'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = $subject; $mail->Body = $body; //$mail->AltBody = ' '; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } } [/code] Подробнее здесь: [url]https://stackoverflow.com/questions/79422472/php-mailer-emails-with-the-same-sender-recipient-and-subject-dont-go-into-one-e[/url]