Usage Samples

Some examples of configuration files and scripts with notes on what they do.

Important: It is essential to have the DNS record for any domain set up correctly, before you can use the gateway. If you are part of a university or company network, you should perhaps contact your it department so they can set this up for you. If you are doing it under your own steam there are very many domain registrars which have a control panel that gives you complete control of your domain. You need to set up a standard A Record for the ip address of the computer running the computer, and then an MX Record for each to the email domains you wish to handle on the computer running the gateway.

XML Configuration


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE webmailconfig SYSTEM "config.dtd">
<webmailconfig>
	<topleveldomain match="example1.net">
		<user match="*" href="http://smtp2http.sourceforge.net/eg1.php"/>
	</topleveldomain>
	<topleveldomain match="example2.net">
		<user match="*" href="http://another.servers.net/eg2.php"/>
	</topleveldomain>
	<topleveldomain match="example3.net">
		<user match="*" href="http://one.more.org/eg3.php"/>
	</topleveldomain>
</webmailconfig>

This basic sample is similar to the configuration which distributes with version 0.05 pre alpha version of smtp2http. It is well formed XML compliant to the config.dtd file. This configuration file demonstrates using the smtp to http request gatway to handle the email from 3 different domains and post the mail each domain to a different php page. The program emulates a mime encoded form post from a browser, so its not necessary to have PHP installed on the server, any mechanism that understands these kinds of posts will work.

PHP Scripts


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>SMTP2HTTP Test Page</title>
</head>

<body>
This page should not be called directly. It is for receiving requests from
smtp2http.<br>
More Details at <a href="http://smtp2http.sourceforge.net">
http://smtp2http.sourceforge.net</a><br>
<?php 

$message="From: ".$from."\nTo: ".$to."\nSubject: ".$subject."\nHeader: "
 .$header."\nBody: "
 .$body."\n";

mail($from, "Re: ".$subject." (".$tousername.")", $message,
     "From: webmaster@$SERVER_NAME\r\n"
    ."Reply-To: ".$to."\r\n"
    ."X-Mailer: PHP/" . phpversion());	
?>
</body>
</html>

This script just sends the message back to the originator, first changing the subject line a little.

ASP Scripts

Coming Soon

JSP Scripts

Coming Soon


Thanks to SourceForge Logo for providing source code development and hosting facilities