v2.5.2
Giriş yap

PHPMailer error yok ve mail gelmiyor

bukr3j
303 defa görüntülendi ve 2 kişi tarafından değerlendirildi
        <?php
                    require 'PHPMailerAutoload.php';
					$subject = "İletişim";			

					// kullanmak istemediğiniz özelliği false yapınız
					$extra = array(
						"form_subject"	=> true, // mesaj konusu
						"form_cc"		=> true, // mesaj kopyasını kendine gönder
						"ip"			=> true, // mesaja ip adresi eklensin mi
						"user_agent"	=> true  // mesaja user agent eklensin mi
					);
					class my_phpmailer extends PHPMailer {
						// Set default variables for all new objects
						public $From     = 'mailadresi';
						public $FromName = 'isim';
						public $Host     = 'host';
						public $Mailer   = 'smtp';                         // Alternative to isSMTP()
						public $WordWrap = 75;

						// Replace the default debug output function
						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");
						}
						else {

						}


					$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 = "mail.smtp.com";
						$mail->Port = 25;//Set the SMTP port number - likely to be 25, 465 or 587
						$mail->SMTPAuth = true; // turn on SMTP authentication

						$mail->CharSet = 'UTF-8';
						//Ask for HTML-friendly debug output
						$mail->Debugoutput = 'html';
						$mail->SMTPOptions = array(
						'ssl' => array(
							'verify_peer' => false,
							'verify_peer_name' => false,
							'allow_self_signed' => true
							)
						);
						//Whether to use SMTP authentication
						$mail->SMTPAuth = true;
						//Set who the message is to be sent from
						$mail->setFrom($email);
						$mail->SMTPAuth = true;
						//Username to use for SMTP authentication
						
						$mail->Username = "gönderilenmail";//gönderen mail kullanıcı adı
						//Password to use for SMTP authentication
						$mail->Password = "sifre";	
						// Now you only need to add the necessary stuff
						$mail->addAddress('mailadresim', 'Ayberk SOKUL');
						$mail->Subject = $baslik;
						$mail->Body    = $body;	
						
					} catch (phpmailerException $e) {
						echo $e->errorMessage(); //Pretty error messages from PHPMailer
					} catch (Exception $e) {
						echo $e->getMessage(); //Boring error messages from anything else!
					}
	?>
Sorun nerede? PHPMailer en güncel sürümde. phpmailer diye bir klasörde phpmailer ile alakalı her şey. Hata vs de almıoyrum
Cevap yaz
Cevaplar (3)
bukr3j
661 gün önce

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.

<?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();
        }
    }
?>
bukr3j
661 gün önce

Aynı, hepsini denedim. port 465' i de denedim.

iskenderhalisoglu
663 gün önce

$mail->Port = 25; 587 olarak değiştirip dener misin?