PHP: Sending Mail using Mercury & Thunderbird

learn how to configure Mercury Mail server and Thunderbird mail client  and try PHP Code to send mail to own configured mail server!
Be sure XAMPP is running! Now click on start button to start Mercury Mail Server..

  •  Now click on admin button!

Img2

  • Now select MercuryS SMTP Server!

Img3

  • Now assign the values given in fields in following snapshot for MercuryS SMTP Server !

Img4

  • Now select MercuryP POP3 Server !

Img5

  • Now assign the values given in fields in following snapshot for MercuryP POP3 Server !Img6

  • Now select MercuryE SMTP client!

Img7

  • Now assign the values given in fields in following snapshot for MercuryE SMTP client !Img8

  • Now select MercuryD POP3 client!

Img9

  • Now Create MAIL-USER ! click on add button..

Img10

  • Now fill the MAIL-USER Detail and press Ok button!

Img11

  • after OK button , it looks as.. Now press Save Button!

Img12

  •  Create mail address Aliases!

14

 

  • Now download thunderbird mail client program ...and install it on your machine!

Img13

 

  • Open thunderbird and create a new account ! click on " Email" !

Img15

  • Now press " Skip this and use my existing email!"

 Img16

  • Fill the MAIL-USER detail as created earlier in Mercury POP3 client...

Img17

  • after successfully  configuration "Mail Account setup", it gives following ... now press done!

Img18

  • final window appears .. now check "I understand the risk" and press done!

Img19

  •  try this PHP code 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Mail</title>
</head>
<body>
<?php
$to = "shail@localhost";
$subject = "Holi  wishes !";
$message="Happy holi to you and your  batch mate".PHP_EOL;
$headers = "From: admin@localhost"; 
if (mail($to, $subject, $message, $headers)) 
{
echo("Message successfully sent!");
} 
else 
{
echo("Message delivery failed...");
}
?> 
</body>
</html>

  • after executed the above  PHP code , now check whether Mail is delivered or not, open Thunderbird ... and select account and press "Get messages"!Img20

 

  • Note if your mail client not showing the mail received then edit following line in php.ini !

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
 SMTP = localhost
 smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = postmaster@localhost
;sendmail_from = NULL
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.  
; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
;mail.add_x_header=Off
mail.add_x_header="0"

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\php\logs\php_mail.log"
           
           

  • Note if Thunderbird not recognizes the mail user and password to configure Mercury POP3 client.

    Go to Mercury admin panel! open Configuration>>Manage Local Users

Img21

Img22