Jump to content

Im trying to send email with PHP!!


00stuff

Recommended Posts

I"m trying to send email with PHP and go an Internal Error 500 on my server. I think it might be my script. Can some one tell me if ther is something wrong with it please?

 

<?php
$name_first = $_POST['name_first'];
$name_last = $_POST['name_last'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message2 = 'First Name: " . $name_first . " 
Last Name: " . $name_last . " 
Phone: " . $phone . " 
Email: " . $email . "';
$to = '" . $receive_email . "';
$subject = 'Registration to " . $company_name . "';
$message = $message2;
$from = '" . $receive_email . "';
$headers = 'From:' . $from;
mail($to,$subject,$message,$headers);
echo 'Mail Sent. Click <a href="register.php">here</a> to go back!';
?>

Link to comment
https://forums.phpfreaks.com/topic/241997-im-trying-to-send-email-with-php/
Share on other sites

your code is a mess and needs cleaned up, I will clean it up for you.

Also, view the link that premiso provided for more information on using correct parse syntax for variables inside of double quotes..

Do you receive any parse errors?

 

<?php
$name_first = $_POST['name_first'];
$name_last = $_POST['name_last'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message = "First Name: $name_first \n 
Last Name: $name_last \n 
Phone: $phone \n
Email: $email \n";
$to = "$receive_email";
$subject = "Registration to $company_name";
$from = "$receive_email";
$headers = "From: $from";
$mail = mail($to,$subject,$message,$headers);
if(!$mail){
      ini_set('track_errors,1');
      print $php_errormsg;
}else{
print 'Mail Sent. Click <a href="register.php">here</a> to go back!';
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.