PDA

View Full Version : Simple php script not working



reden
04-02-2007, 08:43 AM
This code is being called from a flash form. It doesn't work on this server, but it works on a different server, how come? Please help, thanks.


<?php

$to = "myemail@myserver.com";
$msg = "Name: $name\n\n";
$msg .= "Email: $email\n\n";
$msg .= "Phone: $phone\n\n";
$msg .= "Location: $location\n\n";
$msg .= "Comment:\n $message\n\n";

mail($to, $subject, $msg, "From: $email\nReply-To: $email\n");

?>

areidmtm
04-02-2007, 09:49 AM
the from email has to actually exist in cPanel.

reden
04-02-2007, 10:08 AM
what do you mean exist in cpanel? the from email being parsed is the user's email he's inputting in the flash form? If you're referring to the "to" email being myemail@myserver, I changed that particularly for this topic just to not post my private email.

areidmtm
04-02-2007, 10:13 AM
I mean exactly what I said. The from email has to be from an email off of your account. The reply to address can be the users email address or just include his email address in the message so you know who it was from.

cabbie
04-02-2007, 11:28 AM
<?php
$to = ‘user@domain.com’;
$subject = ‘Subject’;
$message = ‘This is a test’;
$headers = ‘From: webmaster@yourdot.com’ . “rn” .
‘Reply-To: webmaster@yourdot.com’ . “rn” .
‘X-Mailer: PHP/’ . phpversion();

mail($to, $subject, $message, $headers);
?>

The $headers string would modified to be inputted by sender.