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

include "mail/class.phpmailer.php";
$mail = new PHPMailer;

$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail..online'; // Specify main and backup server
$mail->Port = 465; // Set the SMTP port
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted

$mail->From = '[email protected]';
$mail->FromName = 'Ali ';
$mail->AddAddress('@gmail.com', 'Ali'); // Add a recipient // Name is optional

$mail->IsHTML(true); // Set email format to HTML
$mail->CharSet = 'UTF-8';
$mail->AddAttachment('veritabaniyedek.zip');

$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <strong>in bold!</strong>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}

bu benim kullandığım mail sınıfı veritabanı yedeğini göndermek için kullanıyorum sadece dosya ekleyip çalışıyor yani kullanıcı bilgilerini düzenleyip dene bir