Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable XAMPP to locally use the php's mail() function so I can test my mail() scripts locally without having to upload to my server?

I am currently using XAMPP and Thunderbird 3 and wish to set up my local server to send mail to e-mails like gmail/hotmail/(anymail) so I can test out my php scripts that are using the mail() function. It would save some time as it would bypass the step of tediously saving and uploading the php file every time a minor change is made.

Things I have done but have not worked: (through various existing tutorials online)


  1. Installed XAMPP (successfully installed as I already use this for my other work)
  2. Installed Mercury for XAMPP
  3. In Mercury

a. click on Configuration -> Manage Local Users
b. Create New User

          Username: **root**
          Password: **root**
c. click on Configuration -> Mercury SMTP
d. make the following changes

          IP Interface to use: **127.0.0.1**
          Listen to TCP/IP port: **25**
          Announce Myself as: **127.0.0.1**
e. click on Configuration -> Mercury POP 3
f. make the following changes

          Listen to TCP port: **110**
          IP Interface to use: **127.0.0.1**
g. click on Configuration -> MercuryE SMTP client Configuration
h. make the following changes

          Identify Myself as: **127.0.0.1**
          Name server: **127.0.0.1**
i. click on Configuration -> Mercury D pop3 client
j. make the following changes

          POP3 Host: **127.0.0.1**
          Username: **root**
          Password: **root**

4. Installed Thunderbird 3 5. In Thunderbird


a. click on Tools -> Account Settings
b. In Account Settings

    i. click on Account Actions -> Add Mail Account
    ii. In Add Mail Account

        Your name: **root**
        Email address: **[email protected]**
        Password: **root**
    iii. click next
    vi. under Editing Config set as following

        Username: **root**
        Incoming: 127.0.0.1   POP/IMAP
        Outgoing: 127.0.0.1   SMTP
    v. click Create Account
c. send test mail to myself (this part doesn't work for me, it says mail sent successfully but when I check inbox in Thunderbird, there is no mail.)

4. Test PHP mail() script (I haven't gotten to this step yet as I have not yet been able to successfully set up a local mail server.)

like image 511
Simon Suh Avatar asked Dec 20 '10 01:12

Simon Suh


People also ask

Can I send email from localhost xampp?

You can send mail from localhost with sendmail package , sendmail package is inbuild in XAMPP. So if you are using XAMPP then you can easily send mail from localhost. For example, you can configure C:\xampp\php\php. ini and c:\xampp\sendmail\sendmail.

Does PHP mail function work on localhost?

The PHPmailer library provides the way to send an email from localhost with the SMTP server using PHP. We will use the Gmail account as an SMTP server to sending the email from localhost.


1 Answers

These helped me out when I was having trouble.

http://www.danieltmurphy.com/setting-up-mercury-smtp/

http://www.youtube.com/watch?v=VU4PT7xMSO0

Mercury can be activated from the Xampp control panel.

like image 142
Ashley Staggs Avatar answered Sep 17 '22 21:09

Ashley Staggs