|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
PHPMailer SMTP ErrorAt first i was getting this as my error:
Mailer Error: Language string failed to load: connect_host I looked around the net for some answers and found that this was because of the language files. Looked in the language folder and the english file was not even included XD... Got that and fixed the language error, and now i get a new error: Mailer Error: SMTP Error: Could not connect to SMTP host. I have checked, rechecked, triple-checked, and quad-checked my credentials and have not found any wrong information. I am trying to connect to the gmail smtp server to send out mails using my own gmail account. I have already added support for ssl by taking the semicolon off in the php.ini file and moved two 32 files from the php folder into my system32 folder (can't remember names XD). Here is my script: <?php require("class.phpmailer.php"); $mailer = new PHPMailer(); $mailer->IsSMTP(); $mailer->Host = 'ssl://smtp.gmail.com:465'; $mailer->SMTPAuth = TRUE; $mailer->Username = 'myemail@gmail.com'; $mailer->Password = 'mypass'; $mailer->From = 'myemailagain@gmail.com'; $mailer->FromName = 'myname'; $email1 = $_GET['email']; $verification = rand(); $mailer->Body = 'Verification Link: http://www.mysite/myverification.php?myvariable="'.$verification.'" '; $mailer->Subject = 'verification'; $mailer->AddAddress($email1); if(!$mailer->Send()) { echo "Message was not sent<br/ >"; echo "Mailer Error: " . $mailer->ErrorInfo; } else { echo "Message has been sent"; } ?> Thanks for the help guys =) |
|
|
Re: PHPMailer SMTP ErrorNot sure if I'm using a different version of PHPMailer than you, but here's what worked for me:
include("class.phpmailer.php"); include("class.smtp.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port $mail->Username = "yeah"; // GMAIL username $mail->Password = "right" // GMAIL password Hope it helps. MoJoPokeyBlue |
|
|
Re: PHPMailer SMTP ErrorI tried your script and got an internal server error even after i put a semi colon after the password variable.
Here's my script now: <?php include("class.phpmailer.php"); include("class.smtp.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port $mail->Username = "myemail@gmail.com"; // GMAIL username $mail->Password = "myemailpass"; // GMAIL password $mailer->From = 'myemailagain@gmail.com'; $mailer->FromName = 'myname'; $email1 = $_GET['email']; $verification = rand(); $verification2 = rand(); $mailer->Body = 'Verification Link: http://www.mysite/myverification.php?myvar="'.$verification.$verification2.'" '; $mailer->Subject = 'Verification'; $mailer->AddAddress($email1); if(!$mailer->Send()) { echo "Message was not sent<br/ >"; echo "Mailer Error: " . $mailer->ErrorInfo; } else { echo "Message has been sent"; } ?> What version are you using? I might have to try that one. Thanks!
|
|
|
Re: PHPMailer SMTP ErrorWhen you create a new instance, you have to use the same name throughout the code. You start off using $mail-> and then switch to $mailer->. Use either one or the other.
MoJoPokeyBlue |
| Free embeddable forum powered by Nabble | Forum Help |