How to send mail from Localhost with mercury


Requirements
A Web server : Here we use the xampp package. You can download it from here. It is very easy to install and does not require any expertise.
A Mail server : Mercury/32 Mail Transport System is an excellent mail server bundled with XAMPP. So no need to search for any other mail server.
A Mail Client : You need to have a mail client to receive mails sent from localhost or basically from your Mercury/32 mail server. Mail clients include outlook express, thunderbird, Eudoramail etc. For this tutorial I will be using the default mail client available with Windows system , ie the outlook express.
The Steps to Configure Mercury/32 mail server

The following steps will guide you through the working of mail function on localhost.

1) You need to start the localhost web server. The XAMPP in this case.

xampp start

 

2) By default XAMPP will not start the mercury mail server. So you need to click on start to start the mercury/32 on the XAMPP control panel.

3) Click on the Admin Button next to mercury on XAMPP control panel. This will open the Mercury/32 Admin Panel. Click on Configuration -> Manage Local users.mercury32interface

 

4) Create a New User. Let
Username : your choice

Password : your choice

mercury add user details

 

5) Next, from the Mercury/32 Admin panel, Go to Configurations -> Mercury SMTP server and make the following Changes.
IP Interface to use : 127.0.0.1
Listen to TCP/IP port : 25

Announce Myself as : 127.0.0.1mercury32 smtp server

 

6)Next, from the Mercury/32 Admin Panel , Go to Configurations -> Mercury POP 3 Server and fill in the following details.
Listen to TCP port : 110

IP Interface to use : 127.0.0.1

mercury pop3 server

 

7) Next, from the Mercury/32 Admin Panel, Go to Configurations – > MercuryE SMTP client Configuration , and make the following changes
Identify Myself as : 127.0.0.1

Name server : 127.0.0.1

mercury pop3 server

8) Next step is from the Mercury/32 panel go to Configuration -> Mercury D pop3 client and there create a new Account. Click on “ADD” and then enter the following details for “Edit POP3 mailbox definition” dialog box.
POP3 Host : 127.0.0.1
Username : your choice
Password : your choice

And then click on save.

MercuryD POP3 client

This finishes Configuration of your Mercury/32 Mail transport system.

We now have to configure a mail client, so as to receive mails. You can outlook or thunderbird and else

– At Enter email Id: yourchoice@localhost.com

– Then click Next. On the Internet Connection wizard,

Select POP3 for my incoming mail server.
For Incoming mail (POP3, IMAP, HTTP) server, enter
127.0.0.1
For Outgoing (SMTP) server, enter

127.0.0.1

 

You can now test your php code to check if your script is working successfully or not.You can try this script. Copy the code and save it in a file for eg mail.php. Save this file in your root folder , for xampp it will be in your htdocs folder.
//php code to send mail,
//author : tutorit
//Use this code to send a test mail from your localhost.

$to = “root@localhost.com”;
$subject = “Hi!”;
$body=”test”.PHP_EOL;
$body.=”Hello World.just want to test my localhost server”.PHP_EOL;
$body.=”Regards”.PHP_EOL;
$body.=”tutorit”.PHP_EOL;
$body.=”https://tutorit.wordpress.com”.PHP_EOL;

$headers = “From: yourname@localhost.com”;

if (mail($to, $subject, $body, $headers)) {
echo(“Message successfully sent!
“);
} else {
echo(“Message delivery failed…
“);
}
?>

Run the script. If all went well, the script should execute successfully. Check your email. You should receive an e-mail.

Satu Tanggapan

  1. Thnx for posting this awesome information. Keep up this good work. I’ll subscribe to your website also. thnx!

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: