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}";
    }
recepkaramanli61
530 gün önce

$this->mail->SMTPSecure = 'tls';
$this->mail->Port = 587;

bendede aynı sorun olmuştu, hosting firmasından destek alarak yukarıdaki ayarları yaparak ve
PHP versiyonunu ALT-PHP ile değiştirerek sorunu çözmüştük.