Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6867117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:16:10+00:00 2026-05-27T03:16:10+00:00

php.ini [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = ssl://smtp.gmail.com ; http://php.net/smtp-port

  • 0

php.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = "ssl://smtp.gmail.com"
; http://php.net/smtp-port
smtp_port = 465  

I would like to send email in php using gmail SMTP server and did change on php.ini(See above code). Also add $host, $port, $username and $pw into the sendEmail.php.

However, email still can not be sent out. Can anyone help me? Thanks!

sendEmail.php

 $host = "ssl://smtp.gmail.com";
 $port = "465";
 $username = "username@googlemail.com";
 $password = "password";

 $email_to = "n.liu@the-imcgroup.com";
 $email_subject = "Test E-Mail";
 $email_body = "Email Body";

 if(mail($email_to, $email_subject, $email_body)){
    echo "The email was successfully sent.";
 } else {
    echo "The email was NOT sent.";
 }

?>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:16:11+00:00Added an answer on May 27, 2026 at 3:16 am

    Things will very likely be much easier for you if you use a library like PHPMailer for this purpose:

    http://phpmailer.worxware.com/

    Using this class will aid in setting proper headers, configuring addressing and ensuring better deliverability in general.

    Here’s an example connecting to the gmail SMTP just like you described:

    http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this problem: PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable
've registered xdebug in php.ini (as per http://xdebug.org/docs/install ) but it's not showing up
I have like 50 different php files which all use the mail function. After
I'm trying to figure out why the mail function in PHP fails when called
I have a mail function $to = fahad@somewhere.com; $subject = Voucher Number: .$voucher; $message
<?php //define the receiver of the email $to = 'pradz39@gmail.com'; //define the subject of
$to = jijodasgupta@gmail.com; $subject = Hi!; $body = Hi,\n\nHow are you?; if (mail($to, $subject,
Possible Duplicate: php mail() function on localhost I'm trying to do some localhost testing
I'm trying to use php's mail() function but keep getting an error. I've installed
I'm having an error trying to send mail with PHP using the mail() function.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.