Download
http://swiftmailer.org/downloads/get/Swift-4.0.6.tar.gzand then upload it to your server. copy the code below into two files
one named form.html (arbitrary) and the php is named contact.php after filling in your mailserver address and your email and your name in the php script, put them in the Swift-4.0.6 folder on your server. then point your browser to the form.html file.
######### start html form ######################
<form action="
http://yoursite/Swift-4.0.6/contact.php" method="post">
<font color="#000000">Your name</font><input name="name" size="40" type="text" />
<font color="#000000">Your email address</font>
<input name="email" size="40" type="text" />
<font color="#000000">Questions or comments:</font>
<textarea cols="40" rows="4" name="description"></textarea>
<span style="color: #000000;"><input type="reset" value="Clear" /><input type="submit" value="Send" /></span>
</form>
############### end of html doc ###################
############# start contact.php ####################
<?php
require_once 'lib/swift_required.php';
$email=$_POST['email'];
$description=$_POST['description'];
$name=$_POST['name'];
function doFormError($errString)
{
echo "$errString";
exit;}
if( !(ereg("^(.+)@(.+)\\.(.+)$",$email)) ) {
doFormError("
<font size=5 color=#000000>You submitted an invalid email address. Please go <a href='Javascript:history.go(-1);'>back[/url] and correct the error.</font>
");
exit;}
$transport = Swift_SmtpTransport::newInstance('your_mailserver', 25);
$mailer = Swift_Mailer::newInstance($transport);
$message=Swift_Message::newInstance();
$message->setSubject('Site Comments');
$message->setFrom(array("$email"=>"$name"));
$headers = $message->getHeaders();
$message->setTo(array('
yourmail@hotmail.com'=> 'you'));
$message->setBody("$description");
$result=$mailer->send($message, $failures);
echo "Thank you for your comments. go <a href='Javascript:history.go(-1);'>back[/url]";
?>
to obtain your_mailserver info you must save the following code to a file and name it test.php (arbitrary).
############################
<?php
# initialize sessions
session_start();
# set session variable to auto-increment
$_SESSION['VAR'] += 1;
echo "<p>If the following number increases everytime you hit the Refresh button, session
variables are working:",$_SESSION['VAR'],"</p>";
if (isset($_ENV["_FCGI_MUTEX_"])) echo "<p>FastCGI Enabled</p>";
phpinfo();
?>
####################################
upload it, then point your browser to it, at the very top of the output it will show your mailservers address it looks something like this:
Linux gator667.hostgator.com 2.6.33.1 #6 SMP PREEMPT Tue Mar 23 23:09:34 CDT 2010 i686
gator667.hostgator.com is my mailserver, yours will be different.
