function SendMail($to, $from, $from_name, $subject, $body) {
include CONFIG . "theme.php";
$dbname = $db['db_name'];
$dbuser = $db['db_user'];
$dbpass = $db['db_pass'];
$conn = odbc_connect("$dbname","$dbuser","$dbpass");
$getmail = odbc_exec($conn,"SELECT mail_user,mail_password,host,port,smtpsecure FROM _site_mail_settings");
$mail_user = odbc_result($getmail,'mail_user');
$mail_password = odbc_result($getmail,'mail_password');
$host = odbc_result($getmail,'host');
$port = odbc_result($getmail,'port');
$smtpsecure = odbc_result($getmail,'smtpsecure');
require_once CONFIG . 'phpmailer/PHPMailerAutoload.php';
define ('GUSER',$mail_user);
define ('GPWD',$mail_password);
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = $smtpsecure; // secure transfer enabled REQUIRED for GMail
$mail->SMTPAutoTLS = false;
$mail->Host = $host;
$mail->Port = $port;
$mail->CharSet = 'UTF-8';
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
} gmail smtp sorunu
2
●126
- 24-12-2023, 21:04:08merhaba phpmailer ile mail gönderimi yapıyordum eskiden fakat şimdi gmail bilinmeyen uygulama sistemini kaldırmış araştırıp 2fa yı doğruladım uygulama şifresi oluşturdum o şifreyi girdim ama olmuyor kodlar aşağıdaki gibidir
- 24-12-2023, 21:12:11göndereceğiniz mailde 2fa kaldırın ve şu linke tıklayıp izin verin:https://myaccount.google.com/lesssecureapps
- 24-12-2023, 21:28:52Bu ayar hesabınızda kullanılamıyor.dexterbilisim adlı üyeden alıntı: mesajı görüntüle
diyor hocam