File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed
06.01-gestion-et-envoi-des-e-mails
02-exemples-de-code/01-envoi-de-mail/public
03-exercices/solution-exercice-01/public Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -288,8 +288,11 @@ try {
288288 $mail->Host = $host;
289289 $mail->Port = $port;
290290 $mail->SMTPAuth = $authentication;
291- $mail->Username = $username;
292- $mail->Password = $password;
291+ if ($authentication) {
292+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
293+ $mail->Username = $username;
294+ $mail->Password = $password;
295+ }
293296 $mail->CharSet = "UTF-8";
294297 $mail->Encoding = "base64";
295298```
Original file line number Diff line number Diff line change @@ -640,8 +640,11 @@ try {
640640 $mail->Host = $host;
641641 $mail->Port = $port;
642642 $mail->SMTPAuth = $authentication;
643- $mail->Username = $username;
644- $mail->Password = $password;
643+ if ($authentication) {
644+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
645+ $mail->Username = $username;
646+ $mail->Password = $password;
647+ }
645648 $mail->CharSet = "UTF-8";
646649 $mail->Encoding = "base64";
647650
Original file line number Diff line number Diff line change 2828 $ mail ->Host = $ host ;
2929 $ mail ->Port = $ port ;
3030 $ mail ->SMTPAuth = $ authentication ;
31- $ mail ->Username = $ username ;
32- $ mail ->Password = $ password ;
31+ if ($ authentication ) {
32+ $ mail ->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS ;
33+ $ mail ->Username = $ username ;
34+ $ mail ->Password = $ password ;
35+ }
3336 $ mail ->CharSet = "UTF-8 " ;
3437 $ mail ->Encoding = "base64 " ;
3538
Original file line number Diff line number Diff line change 4343 $ mail ->Host = $ host ;
4444 $ mail ->Port = $ port ;
4545 $ mail ->SMTPAuth = $ authentication ;
46- $ mail ->Username = $ username ;
47- $ mail ->Password = $ password ;
46+ if ($ authentication ) {
47+ $ mail ->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS ;
48+ $ mail ->Username = $ username ;
49+ $ mail ->Password = $ password ;
50+ }
4851 $ mail ->CharSet = "UTF-8 " ;
4952 $ mail ->Encoding = "base64 " ;
5053
You can’t perform that action at this time.
0 commit comments