나는 우분투, nginx에서 현재 내 사이트를 호스팅하고 있습니다. 도 내가 매우 완벽하게 새롭기 때문에 sendmail을 설치했습니다. 내가 다른 서비스를 설치하고 메일() 함수를 사용하여 이메일을 보내 달성 할 수있는 경우postfix가 Gmail 대신 var/mail/user에 메일을 보내고 있습니다.
<?php
if(isset($_POST['submit'])) {
$name = $_POST['username'];
$email = $_POST['email'];
$number = $_POST['phone'];
$profession = $_POST['profession'];
$to = '[email protected]';
$subject = 'user registration';
$phone = "phone number:".$number;
$message = "client details:"."\n"."Name:".$name."\n"."email:".$email."\n"."phone number:".$number."\n"."profession:".$profession;
$headers = "From:".$email;
if(mail($to, $subject, $message, $headers)) {
header("Location: ../../thankyouNew.html");
} else {
header("Location: ../../somethingWrong.html");
}
}
?>
가능한 중복 https://stackoverflow.com/questions/24644436/php-mail-function- : 여기
는 문서입니다 doesnt-complete-sending-of-e-mail) – QirelPHPMailer가 왜 작동하지 않는지 알아내는 것이 좋습니다. 내장 된'mail()'함수보다 라이브러리를 사용하는 것이 더 좋다. 지금 가지고있는 코드를 사용하면 헤더 삽입에 취약합니다. – Qirel