기껏 당신이 신뢰할 수없는 이메일이 실제로 전송되는 경우 알지 못하거나했습니다 싫어한다 메일을 전달하는 헤더가 발견되면 전달되는 기회가 증가합니다.
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if(mail($to, $sub, $msg, $headers)){
echo "<p>Email Sent</p>";
}
더 나은 방법이 phpmailer 사용하는 것입니다 - 여기 https://github.com/PHPMailer/PHPMailer
이메일을 보내 자신의 샘플입니다
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]', 'Joe User'); // Add a recipient
$mail->addAddress('[email protected]'); // Name is optional
$mail->addReplyTo('[email protected]', 'Information');
$mail->addCC('[email protected]');
$mail->addBCC('[email protected]');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
PHPMailer는 매우 유연하고 아주 작은 옵션을 사용할 수 있습니다, 그것은 또한 할 수있다 SMTP를 사용하도록 구성된 경우 인증 된 계정에서 전자 메일을 보내거나 SendGrid와 같은 타사 전자 메일 서비스를 사용하여 전자 메일을 배달 및 모니터링 할 수 있습니다.
"이메일 주소"는 무엇이라고 생각하십니까? 이 질문은 의미가 없습니다. –
스택 오버플로에 오신 것을 환영합니다! [코드를 이미지로 게시하지 마십시오.] (// meta.stackoverflow.com/q/285551) – FrankerZ
[PHP 메일 양식이 전자 메일 보내기를 완료하지 못했습니다] (http : // stackoverflow. com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail) – FrankerZ