0

I want to know if it is possible to send emails from localhost. If yes, how? I want to send emails from my localhost using my gmail account. I have a Mac OS X Yosemite Version 10.10.1 and I am running XAMPP 5.6.3-0.

Thanks!

littleibex
  • 1,705
  • 2
  • 14
  • 35
  • 1
    possible duplicate of [How to configure XAMPP to send mail from localhost?](http://stackoverflow.com/questions/15965376/how-to-configure-xampp-to-send-mail-from-localhost) – Bob Feb 24 '15 at 05:29
  • Try using something like PHPMailer http://phpmailer.worxware.com/ – andrew-caulfield Feb 24 '15 at 05:30
  • @Bob I want the answer specifically for my configuration – littleibex Feb 24 '15 at 05:34
  • @AndrewCaulfield I just want to know if it is possible to set up XAMPP to so that I can use simple PHP mail() function. I don't want to use a 3rd party application. – littleibex Feb 24 '15 at 05:35
  • @ littleibex there is no other answer than to have a working smtp server. – Bob Feb 24 '15 at 06:04

1 Answers1

4

You can use PHP mailer and not configure SMTP on your machine or you can follow this instructions to configure sendmail with GMAIL. I like option 2 :) (Just for fun). Of course the first option is easier.

  1. First go to the path that you installed Xampp application. By default it is C:\xampp\.
  2. Then we need to find the php.ini file which contains the configurations belong to PHP. This file by default is located at C:\xampp\php\php.ini. Open it using any text editor like notepad.
  3. Using search in the editor try to find sendmail_path. There should be two of them. One is commented using a ; (semicolon) in the beginning of the line , and the other one is not commented. Comment the one that is active and active the one is commented. After the edit it should looks like below... (Similar) sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" ; XAMPP: Comment out this if you want to work with mailToDisk,... ;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
  4. Save the php.ini file and restart the Apache process. This is necessary for the configuration to take place.
  5. Next navigate to the sendmail directory. By default it should be located at C:\xampp\sendmail and open the sendmail.ini in the text editor.
  6. Now we need to set the configuration for the mail server. For this case I chose Gmail. The SMTP address of Gmail is: smtp.gmail.com and the SMTP port for Gmail is 587.
  7. Find smtp_server and write the Gmail SMTP address in front of that.
  8. Find smtp_port and write the Gmail SMTP port in front of that.
  9. Scroll down , you should be able to see auth_username & auth_password. Put your gmail username in front of auth_username and put the password in front of auth_password .
  10. Save and now you are good to send mail from local host.

    • Note that your PHP mail function should have "from" header,otherwise your mail will not go through.
    • Also remember the that the destination will receive the mail from your Gmail address not from the address you put in your PHP code.
Leandro Papasidero
  • 3,728
  • 1
  • 18
  • 33