shwetapandit Posted August 29, 2013 Share Posted August 29, 2013 why it gives me error like this:syntax error, unexpected '@' in C:\wamp\www\PHPMailer_5.2.4\examples\mail1.php on line 17 the snippet are as:suggest me any solution........... <?php require_once "C:\wamp\www\PHPMailer_5.2.4/class.phpmailer.php";$mail = new PHPMailer();$mail->IsSMTP();$mail->IsSMTP(); // enable SMTP$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only$mail->SMTPAuth = true; // authentication enabled$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail$mail->Host = "smtp.gmail.com";$mail->Port = 465; // or 587$mail->IsHTML(true);$mail->Username = "abcabc@gmail.com";$mail->Password = "abcabc";$mail->SetFrom('ab@gmail.com');$mail->Subject = "Test";$mail->Body = "hello";$mail->AddAddress(abcd@gmail.com,'abcabc'); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/281656-syntax-error-unexpected-in-cwampwwwphpmailer_524examplesmail1php-on-line-17/ Share on other sites More sharing options...
PravinS Posted August 29, 2013 Share Posted August 29, 2013 check this line $mail->AddAddress(abcd@gmail.com,'abcabc'); use quotes around email address Quote Link to comment https://forums.phpfreaks.com/topic/281656-syntax-error-unexpected-in-cwampwwwphpmailer_524examplesmail1php-on-line-17/#findComment-1447257 Share on other sites More sharing options...
shwetapandit Posted August 29, 2013 Author Share Posted August 29, 2013 if i m quoting it as u say then it gives:SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (54497120)The following From address failed:abcabc@gmail.com : Called Mail() without being connected Mailer Error: The following From address failed: abab@gmail.com : Called Mail() without being connected Is there any settings for ssl in php.ini. i have only single line about ssl in php.ini that is extension=php_openssl.dll what's problen exacltly i check various sites and blogs but find no solutions. Quote Link to comment https://forums.phpfreaks.com/topic/281656-syntax-error-unexpected-in-cwampwwwphpmailer_524examplesmail1php-on-line-17/#findComment-1447267 Share on other sites More sharing options...
PravinS Posted August 29, 2013 Share Posted August 29, 2013 (edited) your SMTP connection is not working, try telnet from your server telnet smtp.gmail.com 587 telnet smtp.gmail.com 465 Edited August 29, 2013 by PravinS Quote Link to comment https://forums.phpfreaks.com/topic/281656-syntax-error-unexpected-in-cwampwwwphpmailer_524examplesmail1php-on-line-17/#findComment-1447269 Share on other sites More sharing options...
shwetapandit Posted August 29, 2013 Author Share Posted August 29, 2013 where to set this telnet command in php.ini or in cmd prompt thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/281656-syntax-error-unexpected-in-cwampwwwphpmailer_524examplesmail1php-on-line-17/#findComment-1447321 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.