Jump to content

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!';
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.