Cześć,
próbuję na VPS używać klasy phpmailer. Dziwne, bo pomimo błędu i komunikacie o wysłanym e-mailu, nie otrzymuję go. Dlaczego tak się dzieje? Proszę spójrzcie na ten kod:
require_once('../phpmailer/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail = new PHPMailer();
$mail->IsHtml(false); //format wiadomości jeśli true=HTML, false=TXT
$mail->CharSet = "utf-8";
$mail->PluginDir = "/var/www/portfolio/phpmailer/";
$mail->From = "email"; // od
$mail->FromName = "email"; //nazwa
$mail->Host = "smtp.gmail.com"; //adres gmaila ;)
$mail->Port = 587; //port gmaila
$mail->Mailer = "smtp";
$mail->Username = "email";//nazwa admina na poczcie
$mail->Password = "Mojehasło";//hasło admina do konta SMTP
$mail->SMTPAuth = true;
$mail->SetLanguage("pl", "language/");
$mail->SetFrom(''.$email.'', ''.$topic.'');
$mail->Subject = ''.$topic.'';
$mail->AltBody = nl2br($message); // optional - MsgHTML will create an alternate automatically $mail->Body = nl2br('Wiadomość od: '.$name.' || Treść: '.$message.''); $mail->Send();
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else! }
Port 465 też nie działa. Pomożecie?