Aboobie
10-02-2010, 20:53
Ok I need some help!!
I've been doing a web site for a local charity and they want a form that when submitted sends an email.
I've quite happily added a form to the html with client side javascript validation but I'm having trouble with the mail part.
I've decided to use a PHP script to do the work but I'm having trouble getting it all working on their web server. It should be noted I've never worked with PHP before.
Here's what I've written:
<?php
include('Mail.php');
$mail = Mail::factory("mail");
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$number = $_REQUEST['number'] ;
$course = $_REQUEST['course'] ;
$info = $_REQUEST['info'] ;
$from = "Mr Testie <smcshaw@hotmail.com>";
$to = "Steven Shaw <smcshaw@hotmail.com>";
$subject = "Workshop Enquiry from " + $name;
$body = "Workshop enquiry from: " + $name + "\nEmail: " + $email + "\nTelephone number: " + $number + "\nFor course: " + $course + ".\nAdditional Info: " + $info;
$host = "authsmtp.streamline.net";
$username = "info@themusikeracademy.com";
$password = "*******";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
?>
Is this even vaguely right?
They're with streamline and I've got the added problem of inadvertantly taking their web site down as I changed the web server to linux tonight thinking this might have been my problem.
My questions are where do I need to put this on the web server, what do I need change on the server to get it all working? Basically, HELP!
I've been doing a web site for a local charity and they want a form that when submitted sends an email.
I've quite happily added a form to the html with client side javascript validation but I'm having trouble with the mail part.
I've decided to use a PHP script to do the work but I'm having trouble getting it all working on their web server. It should be noted I've never worked with PHP before.
Here's what I've written:
<?php
include('Mail.php');
$mail = Mail::factory("mail");
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$number = $_REQUEST['number'] ;
$course = $_REQUEST['course'] ;
$info = $_REQUEST['info'] ;
$from = "Mr Testie <smcshaw@hotmail.com>";
$to = "Steven Shaw <smcshaw@hotmail.com>";
$subject = "Workshop Enquiry from " + $name;
$body = "Workshop enquiry from: " + $name + "\nEmail: " + $email + "\nTelephone number: " + $number + "\nFor course: " + $course + ".\nAdditional Info: " + $info;
$host = "authsmtp.streamline.net";
$username = "info@themusikeracademy.com";
$password = "*******";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
?>
Is this even vaguely right?
They're with streamline and I've got the added problem of inadvertantly taking their web site down as I changed the web server to linux tonight thinking this might have been my problem.
My questions are where do I need to put this on the web server, what do I need change on the server to get it all working? Basically, HELP!