new_member Posted July 30, 2013 Share Posted July 30, 2013 Hi, I have been using php mailer class to send mail via smtp. I am using my gmail account info Here is the code: $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Mailer = "smtp"; $mail->SMTPDebug = 0; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Port = 456; $mail->Username = 'gmail id'; $mail->Password = 'my password'; $mail->SetFrom('email from id ', 'name'); $mail->Subject = "Email Verification"; $mail->Body = 'Dear '.$_GET['Name'] $mail->AddAddress('test@yahoo.com',$_GET['Name']); $mail->AddReplyTo('admin mail',"Admin"); $mail->IsHTML(true); //$mail->ErrorInfo if(!$mail->Send()) $error_mail = "Mailer Error: ".$mail->ErrorInfo ; else $error_mail = "Message has been sent"; It always gives me error SMTP Connect() failed I have also enabled open ssl extension and uncommented from php.ini. Have also changed the port to 25 but it didnt work. I dont know where the actual problem is?? Quote Link to comment https://forums.phpfreaks.com/topic/280647-sending-mail-via-smtp-authentication/ 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.