v2.5.2
Giriş yap

PHPMailer email gönderemiyorum

egemennk
6,766 defa görüntülendi

Merhaba bir projede kullanmak için PHPMailer sınıfı test ediyordum ama bir türlü email gönderemedim. yardımlarınız için şimdiden teşekkürler.

try {
        //Server settings
        $mail->SMTPDebug = 1;                      // Enable verbose debug output
        $mail->isSMTP();                                            // Send using SMTP
        $mail->Host       = 'smtp.gmail.com';                    // Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
        $mail->Username   = 'email';                     // SMTP username
        $mail->Password   = 'şifre';                               // SMTP password
        $mail->SMTPSecure = "ssl";         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
        $mail->Port       = 465;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

        //Recipients
        $mail->setFrom('email', 'isim');
        $mail->addAddress('email', 'isim');     // Add a recipient
        

        // Content
        $mail->isHTML(true);                                  // Set email format to HTML
        $mail->Subject = 'mail test';
        $mail->Body    = '<b>Test</b>';

        $mail->send();
        echo 'Message has been sent';
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
    }
pcmemo
1506 gün önce

gmail hesabını dah az güvenli cihazlarda da kullanmak için gerekli bir ayarı var onu yapman gerekiyor olabilir.

https://www.google.com/search?q=gmail daha az güvenli uygulama erişimi&amp;oq=gmail daha az g&amp;aqs=chrome.1.69i57j0l5.5838j0j9&amp;sourceid=chrome&amp;ie=UTF-8