Answer the question
In order to leave comments, you need to log in
Is the php script not working on the host to send a message?
Good afternoon, I recently started learning php and ran into such a problem - I wrote a form and a php script for it to send a letter with filled in form data, and everything worked fine on the local host, but after uploading the site to the hosting, the letter is not sent, the script is executed, errors No, but the letter never arrives. please tell me what i did wrong?
script:
<?php
if (!empty($_POST['date1']) AND !empty($_POST['date2']) AND !empty($_POST['number']) AND !empty($_POST[' name']) AND !empty($_POST['phone']) AND !empty($_POST['email']))
{
$headers = "Test";
$theme = "New Application";
$letter[0] = "Customer Data\r\n";
$letter[1] = "\n\n";
$letter[3] = "Departure Date:".$_POST['date2']."\n\n";
$letter[4] = "Number of places:".$_POST['number']."\n\n";
$letter[5] = "Name:".$_POST['name']."\n\n";
$letter[6] = "Phone:".$_POST['phone']."\n\n";
$letter[7] = "Email:".$_POST['email']."\n\n";
$letter[8] = "\n\n";
$letter[9] = "XMailer: PHP/" . phpversion()."\n\n";
$letter[10] = "We need to call him back.";
$message = implode("",$letter);
if (mail("[email protected]",$theme, $message, "Content-type:text/plain; charset = UTF-8\r\nFrom:$headers"
)){ header("Location: /");
}else {
header("Location: /");
}
}else{
header("Location: /page/booking.html");
}
?>
Answer the question
In order to leave comments, you need to log in
In order for letters to reach you, you need to configure the mail server normally.
A normally configured mail server expects a valid mail address in the "From:" line.
A full mailing address is not the first "Test" that comes to mind, it's exactly an address, with @ , with letters and numbers to the left and right of @ , and that would use a real mail server to the right of @ .
Se la vie!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question