Page 1 of 1

PHP Mail

Posted: Tue Jan 24, 2006 3:16 pm
by navaneeth
Hello

I couldn't send mail with this script..I am not getting any errors..But the mail is not coming ? Please explain..

Code: Select all

$mailto = 'jstgermain@methodcomptech.com' ; 

$subject = "MCT Web Mail" ; 

$formurl  = "http://www.methodcomptech.com/methodemail.html" ; 
$errorurl  = "http://www.methodcomptech.com/error.html" ; 
$thankyouurl = "http://www.methodcomptech.com/success.html" ; 

$name = $_POST['name'] ; 
$email = $_POST['email'] ; 
$phone  = $_POST['phone'] ; 
$website =  $_POST['website'] ; 
$comments = $_POST ['comments'] ; 
$http_referrer = getenv ( "HTTP_REFERER" ); 

if (!isset($_POST['email' ])) { 
    header( "Location: $formurl" ); 
    exit ; 
} 
if (empty( $name) || empty($email) || empty($comments)) { 
    header( "Location: $errorurl" ); 
   exit ; 
} 
if (get_magic_quotes_gpc ()) { 
    $comments = stripslashes( $comments  ); 
} 

$messageproper = 

    "This message was sent from:  " .  $name .  
    "\n$http_referrer\n\n" . 
    "________________________( COMMENTS )________________________\n\n"  . 
    "\nName:  " . $name . 
     "\nE-Mail:  " . $email . 
    "\nPhone Number:  " .  $phone . 
    "\nWeb-Site:  " . $website  . 
    "\n\nMessage:  \n" . $comments . 
    "\n\n____________________________________________________________\n"  ; 

mail ($mailto, $subject, $messageproper,  "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: feedback.php" ); 
header ( "Location: $thankyouurl" ); 
exit ;
please tell me some easy ideas to send mail from a php page. Is it needed to import any other classes ?

Navaneeth

Posted: Tue Jan 24, 2006 4:54 pm
by raghavan20
Use PHPMailer class from SourceForge.
If you have any specific error messages in your code, please post them.

Posted: Wed Jan 25, 2006 4:04 pm
by fine
You miss "\r" in your code.

Please see this tutorial send mail in php