Viewed   120 times

I'm finding to proper information about how to send email from localhost WAMP. And how to get authorize to send email from particular authorize email address to send any other email address.

How to configure this whole step explain me details, I already visit here some answer as well as blog post but all are very confusing and old dated so it's may be possible to not working. So i need users help. Thank you.



Configuring a working email client from localhost is quite a chore, I have spent hours of frustration attempting it. At last I have found this way to send mails (using WAMP, XAMPP, etc.):

Install hMailServer

Configure this hMailServer setting:

  1. Open hMailServer Administrator.
  2. Click the "Add domain ..." button to create a new domain.
  3. Under the domain text field, enter your computer's localhost IP.
    • Example: is your localhost IP.
  4. Click the "Save" button.
  5. Now go to Settings > Protocols > SMTP and select the "Delivery of Email" tab.
  6. Find the localhost field enter "localhost".
  7. Click the Save button.

Configure your Gmail account, perform following modification:

  1. Go to Settings > Protocols > SMTP and select "Delivery of Email" tab.
  2. Enter "" in the Remote Host name field.
  3. Enter "465" as the port number.
  4. Check "Server requires authentication".
  5. Enter your Google Mail address in the Username field.
  6. Enter your Google Mail password in the password field.
  7. Check mark "Use SSL"
  8. Save all changes.


If you want to send email from another computer you need to allow deliveries from External to External accounts by following steps:

  1. Go to Settings > Advanced > IP Ranges and double click on "My Computer" which should have IP address of
  2. Check the Allow Deliveries from External to External accounts Checkbox.
  3. Save settings using Save button.
Wednesday, November 16, 2022

Gmail servers use SMTP Authentication under SSL or TLS. I think that there is no way to use the mail() function under that circumstances, so you might want to check these alternatives:

  • PEAR::Mail
  • phpMailer
  • NetteMail

They all support SMTP auth under SSL.

You'll need to enable the php_openssl extension in your php.ini.

Additional Resources:

  • How to Send Email from a PHP Script Using SMTP Authentication (using PEAR::Mail)
  • Send email using PHP with Gmail (using phpMailer)
  • Mailing using NetteMail
Saturday, October 29, 2022

Configuring a working email client from localhost is quite a chore, I have spent hours of frustration attempting it. I'm sure someone more experienced may be able to help, or they may perhaps agree with me.

If you just want to test, here is a great tool for testing mail locally, that requires almost no configuration:

It worked right off the bat for me, hope this helps you.

Wednesday, August 31, 2022

You could use PHPMailer to point to an external SMTP server. Or you could use a simple script that dumps to a file. There are a couple of earlier questions on the same topic, with more ideas.

Wednesday, October 19, 2022

Use PHPMailer. Its available here PHPMailer. You can use it like this:

public function send_mail()
        $mail = new PHPMailer();
        $mail->IsSMTP(); // we are going to use SMTP
        $mail->SMTPAuth   = true; // enabled SMTP authentication
        $mail->SMTPSecure = "ssl";  // prefix for secure protocol to connect to the server
        $mail->Host       = "";      // setting GMail as our SMTP server
        $mail->Port       = 465;                   // SMTP port to connect to GMail
        $mail->Username   = "";  // user email address
        $mail->Password   = "password";            // password in GMail
        $mail->SetFrom('', 'Mail');  //Who is sending 
        $mail->Subject    = "Mail Subject";
        $mail->Body      = '
            <p>Message Body</p><br>
            <p>With Regards</p>
            <p>Your Name</p>
        $destino =; // Who is addressed the email to
        $mail->AddAddress($destino, "Receiver");
        if(!$mail->Send()) {
            return false;
        } else {
            return true;

Remember to set access for less trusted apps in your gmail account

Thursday, August 25, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :