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 = "[email protected]";$mail->Password = "abcabc";$mail->SetFrom('[email protected]');$mail->Subject = "Test";$mail->Body = "hello";$mail->AddAddress([email protected],'abcabc'); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; }?> 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([email protected],'abcabc'); use quotes around email address 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:[email protected] : Called Mail() without being connected Mailer Error: The following From address failed: [email protected] : 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. 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 your SMTP connection is not working, try telnet from your server telnet smtp.gmail.com 587 telnet smtp.gmail.com 465 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 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
Archived
This topic is now archived and is closed to further replies.