View Single Post
 
Old December 14th, 2003, 06:56 PM
mildge mildge is offline
Authorized User
 
Join Date: Nov 2003
Location: , , Australia.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I set the mail parameters into variables that come from a form (in my page not this example) this allows me to build up the body of the email from multiple text boxes.
<?php
$mail_to = "me@somedomain.com";
$mail_subject = "Emails subject";
$mail_body = "blah blah blah";
if (mail($mail_to, $mail_subject, $mailbody))
   echo "Email Sent";
else
   echo "An error has occored while trying to send this email";
?>

i dont have any braces and the script works so maybe PHP is like C when theres only one instruction in the script?

The one problem i did find with sending emails is when the page was hosted on my own pc (eg using localhost) i was unable to send emails even when connected to the internet, however when i put the page onto my ISP's site the email was sent.

Hope this helps

Chris