PHP, SQL and mail

software development

#1

A newbie to PHP programming, I turn to you for help.
I’m setting up a comment board for an online newspaper. To comment, the users have to register. The registration info I manage through PHP, and so far everything works except I have absolutely NO IDEA how to set up an auto-email (so that the admin gets an email stating a new signup, and the new user gets a confirmation sign-up)
I figure it has something to do with setting up some conduit between the canned CGI script provided, and the PHP.
Right now, the user fills out a Form, which sends the info to a PHP script that compiles it into email format and uploads it to my SQL database.
The PHP calls an email class ($mailer = &new Email;), which I’ve defined in the file “email.php” with the following code (lifted from the tutorial book I’m working from)

<?php class Email { function SendMail(){ $Message = stripslashes($this->Message); $Message = stripslashes($this->Message); $headers .="From: ".$this->FromName. "<".$this->FromMail.">\n"; $headers .="Reply-To: ".$this->FromName. "<".$this->FromMail.">\n"; $headers .="X-Mailer: My PHP Mailer\n"; $headers .="Origin: ".$_SERVER['REMOTE_ADDR']."\n"; mail($this->ToMail, $this->Subject, $Message, $headers); } } ?>

Does this look right, or is there something I can do in “email.php” to call the appropriate CGI script supported?
Thanks for any help.


#2

According to the PHP Cookbook, the mail command has 3 parameters with an option 4th header.
So it can look like this
$to = ‘name@example.com’;
$subject = ‘Your subject is here’;
$body = ‘The body of your message is here’;
$header = “Reply-To: webmaster@example.com\r\n”
, “Organization: The Example Group”;
mail($to, $subject, $body, $header);
It then says to separate each header line with \r\n but do not add the \r\n at the end of the last header.


#3

OK… never mind. the code was correct. The problem lay elsewhere (a simply ‘/’ I inadvertantly left in…