/mail/community?hl=en
/mail/community?hl=en
2/15/16
Original Poster
Hebron Laal

Could not connect to SMTP host.

SMTP error : Could not connect to SMTP host.... What to do i tried all the ports 465,25 & 587 still there's a problem...  I hav enabled IMAP too...

This is my code.. Where i am wrong???

function send_mail($email,$message,$subject)
  {            
    require_once('mailer/class.phpmailer.php');
    $mail new PHPMailer();
    $mail->IsSMTP()
    $mail->SMTPDebug  0;                     
    $mail->SMTPAuth   true;                  
    $mail->SMTPSecure "ssl";                 
    $mail->Host       "smtp.gmail.com";      
    $mail->Port       465;             
    $mail->AddAddress($email);
    $mail->Username="hebron...@gmail.com";  
    $mail->Password="*********";            
    $mail->SetFrom('hebron...@gmail.com','Coding Cage');
    $mail->AddReplyTo("hebron...@gmail.com","Coding Cage");
    $mail->Subject    $subject;
    $mail->MsgHTML($message);
    $mail->Send();
  }  
Community content may not be verified or up-to-date. Learn more.
All Replies (1)
Monica J.
2/15/16
Monica J.
Hi Hebron,

Welcome to the Gmail forum!

These are the settings you’ll need if you connect Gmail to a mail client and the mail client can’t auto recognize Gmail’s settings:

Incoming settings
  1. IMAP server: imap.gmail.com

  2. Port: 993

  3. Security type: SSL (always)

  • OR

  1. POP Server: pop.gmail.com

  2. Port: 995

  3. Security type: SSL (always)


Outgoing settings

  1. SMTP server: smtp.gmail.com

  2. Port: 465

  3. Security type: SSL (always)


Let me know if this helps.  Thanks!

Best,
Monica
Was this reply helpful?
How can we improve it?
 
This question is locked and replying has been disabled. Still have questions? Ask the Help Community.

Badges

Some community members might have badges that indicate their identity or level of participation in a community.

 
Expert - Google Employee — Googler guides and community managers
 
Expert - Community Specialist — Google partners who share their expertise
 
Expert - Gold — Trusted members who are knowledgeable and active contributors
 
Expert - Platinum — Seasoned members who contribute beyond providing help through mentoring, creating content, and more
 
Expert - Alumni — Past members who are no longer active, but were previously recognized for their helpfulness
 
Expert - Silver — New members who are developing their product knowledge
Community content may not be verified or up-to-date. Learn more.

Levels

Member levels indicate a user's level of participation in a forum. The greater the participation, the higher the level. Everyone starts at level 1 and can rise to level 10. These activities can increase your level in a forum:

  • Post an answer.
  • Having your answer selected as the best answer.
  • Having your post rated as helpful.
  • Vote up a post.
  • Correctly mark a topic or post as abuse.

Having a post marked and removed as abuse will slow a user's advance in levels.

View profile in forum?

To view this member's profile, you need to leave the current Help page.

Report abuse in forum?

This comment originated in the Google Product Forum. To report abuse, you need to leave the current Help page.

Reply in forum?

This comment originated in the Google Product Forum. To reply, you need to leave the current Help page.