Jump to content

sending mail via smtp authentication


new_member

Recommended Posts

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??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.