Using sendmail is very useful in web development, to easily check if your mail scripts are working. Using it on desktop desktop environment will give you added benefit of sending e-mail from your own computer. However configuring sendmail in Windows environment will still require you to use your ISP’s mail server for purposes of relaying your email. For these purpose we need to configure a web server including the sendmail program. We can either use Apache or IIS for these, but since Apache XAMPP distribution have all these software in place we might just as well use it. Obtain the Apache XAMPP distribution from apachefriends.org
Follow the server’s installation instruction, after that we are ready to configure the sendmail program. Make sure that your server is running by pointing your browser to http://localhost or http://127.0.0.1.
We can find the sendmail program in the directory where we install the XAMPP distribution in my case I put it in D:\XAMPP my sendmail is located in D:\XAMPP\sendmail\
There are two important configurations that we need to touch in order for the sendmail program to work. One is the sendmail.ini which can be found in our sendmail directory in my case that is D:\XAMPP\sendmail\sendmail.ini
We need to put the following code in our sendmail.ini:
smtp_server=yourserver.domain.com
smtp_port=25
smtp_ssl=auto
default_domain=domain.com
auth_username=admin@domain.com
auth_password=password
pop3_server=yourserver.domain.com
pop3_username=admin@domain.com
pop3_password=password
force_sender "just leave blank"
hostname= "just leave blank"
The other one is the php.ini configuration of the PHP XAMMP distribution which can be found in D:\XAMPP\apache\bin\php.ini
For the PHP.ini look for the sendmail path and change it to:
sendmail_path = “D:\xampp\sendmail\sendmail.exe -t”
Restart your Apache installation and let us test our sendmail configuration using the following script
#enclose the following in php tags and save as emailtest.php
$from_name = 'This Sender is testing';
$from_email = 'admin@yourdomain.com';
$headers = "From: $from_name <$from_email>";
$body = "Hi, \nThis is a test mail from $from_name <$from_email>.";
$subject = "Test mail from this sender";
$to = 'noreply@eg-designstudio.com';
if (mail($to, $subject, $body, $headers)) {
echo "success!";
} else {
echo "fail…";
}
If your configuration is correct you will received the following message in your inbox:

Download Our Community Browser Toolbar
Discussion
No comments for “How to use Sendmail in Windows”
Post a comment
You must be logged in to post a comment.