|
Your Email Server yourself
|
|
|
|
|
Friday, 20 March 2009
|
HTML clipboard
When you create an auto email sender program with mail() function.
You can not to test it on your machine(localhost). You have to upload and test
it on your web hosting, but now you can test php mail() function on
your localhost using Argosft mail server.
ArGoSoft Mail Server is full SMTP/POP3/Finger/IMAP server
for all Windows platforms, which will let you turn your computer into the
email system. It is very compact, takes about 1-5 Mb of disk space (depending
on the version), does not have any specific memory requirements, and what is
the most important - it's very easy to use.
ArGoSoft Mail Server Installation.
- Install this program to your machine.
- Go to Tools > Options. Then select tab "Local Domains".
1. Put "localhost" and click "Add" button.
2. Click "OK" button.
- Go to Tools > User
1. Click on Add New User icon.
2. Fill your user name, name, password. User name refers to your email
address (username@localhost). Then click "OK" and "Close" button.
- Set up your Email Client Software. (Microsoft Outlook, Incredimail,
Mozilla Thunderbird, etc.) by create a new email account with information
below;
- Email address "webmaster@localhost" and password as the same that created
in ArGoSoft Mail Server.
- Incomming and Outgoing mail use "localhost".
- Other settings, you should be set as the standard settings or default by
programs.
Test your email server
Create a PHP file "send_email.php" for test ArGoSoft Mail Server
on your machine. This file using mail() function for send some parameters from
this file to your email server.
Syntax:
mail(target_email, subject, message, email_from);
send_email.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?
$to="webmaster@localhost";
$subject="Test Email";
$mail_from="from:
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
n";
$mail_from .="Content-Type: text/html; charset=utf-8 n";
$message="Hello, This is your test email.<br>
Your email server is working now!
";
$sentmail = mail($to,$subject,$message,$mail_from);
if($sentmail){
echo "Email has been sent.";
}
else {
echo "Cannot send email.";
}
?>
</body>
</html>
- Copy this code and save as send_email.php to your root folder,
open this file by browse to http://localhost/send_email.php.
- Open your email client program to recieve email.
|