0
私はPHP初心者です。基本的な登録フォームを作成して、詳細を記入してメールを送ってみたかったのです。私はリモートサーバー上にこれを持っています。私は電子メールを送ることができません。誰かが問題を解決するのを助けてくれますか?メールはそれぞれのメールに送信されません。PHP、
if($conn->query($sql) === TRUE){
$message =
'ID: 201701'.$conn->insert_id. '
Prefix: ' . $prefix . '
Name: ' . $name . '
Contact Number: ' . $contactNo . '
Address: ' . $Address . '
Email: ' . $email . '
Job Title: ' . $JobTitle . '
Organization: ' . $Organization . '
City: ' . $City . '
State: ' . $State . '
Pin Code: ' . $Pincode;
mail('[email protected]', 'Registration for xyz',$message, $name."<".$email.">");
[email protected]にメールを送信しますが、下のメールには送信しません。
$email = "[email protected]";
$to = $email;
$subject = "Confirmation mail";
$message = "Hello $prefix $name
ID: 201701$conn->insert_id
Prefix: $prefix
Name: $name
Contact Number: $contactNo
Address: $Address
Email: $email
Job Title: $JobTitle
Organization: $Organization
City: $City
State: $State
Pin Code: $Pincode";
$from = "[email protected]" ;
$headers = "From: XXX 2016<[email protected]>";
$mail = mail($to,$subject,$message,$headers);
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
if($mail)
{
echo '<p style="font-size:22px; color:green"><b>Thank You !<br/><br/>You are now Registered.</b></p>';
}
else
{
echo '<span style="color:red">Your registration was not successful. Please try again later or send a mail to [email protected]</span>';
}
ps電子メールIDのxxxまたはyyyの数は考慮しないでください。これはちょっとしたランダムメールです。