v2.5.2
Giriş yap

PHPMailer error vermiyor ama mail gelmiyor.

bukr3j
627 defa görüntülendi ve 3 kişi tarafından değerlendirildi

Böyle bir şey de denedim gene olmadı, G-Recaptcha vs. ekledim, bir kaç hata çıktı onları düzelttim ama gene mail göndermiyor hiçbir hata da vermiyor. Bütün portları denedim aynı zamanda localhost ve sunucu üzerinde de denedim.

<?php
    include_once "../phpmailer/src/PHPMailer.php";
    include_once "../phpmailer/src/Exception.php";
    $subject = "İletişim";
    require("../phpmailer/src/PHPMailer.php");
    require("../phpmailer/src/SMTP.php");
    if (isset($_POST['g-recaptcha-response']) && $_POST['submit']){
        $secret = "google re-captcha secret-key";
		$response = $_POST['g-recaptcha-response'];
		$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify=secret=' . $secretkey . '&response= ' . $response);
		$responseData = json_decode($verifyResponse);
		require 'PHPMailerAutoload.php';
		$subject = "İletişim";
        $extra = array(
            "form_subject"	=> true,
            "form_cc"		=> true,
            "ip"			=> true,
            "user_agent"	=> true
        );
        class my_phpmailer extends PHPMailer {
            public $From     = 'mailadresi';
            public $FromName = 'isim';
            public $Host     = 'host';
            public $Mailer   = 'smtp';
            public $WordWrap = 75;

            protected function edebug($msg) {
                print('My Site Error');
                print('Description:');
                printf('%s', $msg);
                exit;
            }
        }
        if ($_POST){
            $ad = strip_tags($_POST['ad']);
            $soyad = strip_tags($_POST['soyad']);
            $number = strip_tags($_POST['phone']);
            $email = strip_tags($_POST['email']);
            $message = strip_tags($_POST['message']);
            $baslik = "WEB Mesaj: ";
            $baslik .= $subject; 
        }
        $body = "Sitenizden bir alıcı sizinle iletişime geçmek istiyor.\n\n";
        $body .= "Adı - Soyadı: " . $ad . " " . $soyad ."\n";
        $body .= "Telefon numarası: ". $number . "\n";
        $body .= "Mail adresi: ". $email . "\n";
        $body .= "Mesaj: ". $message . "\n";
        $body = wordwrap($body, 70);
        if (function_exists('mb_encode_mimeheader')) {
            $subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
        }
        $mail = new my_phpmailer;
        try {
            $mail->isSMTP();
            //Enable SMTP debugging
            // 0 = off (for production use)
            // 1 = client messages
            // 2 = client and server messages
            $mail->SMTPDebug = 2;
            $mail->Mailer = "smtp";
            $mail->Host = "host.mail.com";
            $mail->Port = 465;
            $mail->SMTPAuth = true;

            $mail->CharSet = 'UTF-8';
            $mail->Debugoutput = 'html';
            $mail->SMTPOptions = array(
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
                )
            );
            $mail->SMTPAuth = true;
            $mail->setFrom($email);
            $mail->SMTPAuth = true;
            $mail->Username = "[email protected]";
            $mail->Password = "password";
            $mail->addAddress('[email protected]', 'Jotaro Kujo');
            $mail->Subject = $baslik;
            $mail->Body    = $body;	
            
        } catch (phpmailerException $e) {
            echo $e->errorMessage();
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
?>
rotaile
689 gün önce

dostum merhaba, benim hali hazırda kullandığım bir phpmailer dosyam var githubdan almıştım.
Şuanda da kullanıyorum, şu şekilde vereyim sana kendine göre düzenler kullanırsın.

rar olarak ekledim dosyaları drive ile paylaştım. phpmailer dosyası aşağıdaki kodları eklediğin sayfa ile aynı dizinde olmalı


//mailer sınıflarını dahil etme

use PHPMailer\PHPMailer\Exception;

use PHPMailer\PHPMailer\PHPMailer;


require 'PHPMailer/src/Exception.php';

require 'PHPMailer/src/PHPMailer.php';

require 'PHPMailer/src/SMTP.php';


//php mailer kullanımı

$mail = new PHPMailer();

$mail->IsSMTP();

$mail->SMTPAuth = true;

$mail->Host = 'smtp.gmail.com';

$mail->Port = 587;

$mail->Username = 'mailGö[email protected]';

$mail->Password = 'Mail Adresinin Şifresi';

$mail->SetFrom('Mail Gönderen Kişi');

$mail->AddAddress("mail gönderilcek kişi");

$mail->CharSet = 'UTF-8';

$mail->Subject = 'Mail Konusu';
}

$mail->MsgHTML("mail içeriği");

if ($mail->Send()) {
    
    echo 'Mail gönderildi!';
    
} else {
    
    echo 'Mail gönderilirken bir hata oluştu: ' . $mail->ErrorInfo;
    
}

dosyaları burada