PHP를 통해 제출하는 문의 양식이 있지만 전달 된 이메일 주소로 전송하는 데 문제가 있습니다.왜 내 PHP 이메일 양식은 특정 주소로만 전자 메일을 보내고 있습니까?
내 사이트는 iPage에서 호스팅되며, iPage의 MX 레코드는 내 이메일과 도메인이 등록/관리되는 호버를 가리 킵니다. 호버에서 전자 메일 전달 ([email protected], 몇 년 동안 사용해온 전자 메일로 전달) 만 설정되어 있으며 매력처럼 작동합니다. [email protected] 이메일로 전송 된 모든 이메일은 내가받은 이메일에 대해 곧바로 내받은 편지함으로 전송됩니다.
그러나 내 사이트의 php 문의 양식이 내 이메일에 정보를 제공하지 않습니다. "받는 사람"입력란을 설정하여 영원히 사용한 적이있는 이메일을 보내면 연락 양식이 내 이메일에 바로 제출합니다. 그러나 "받는 사람"필드에 [email protected] 전자 메일을 사용하면 연락처 양식이받은 편지함에 도달하지 않습니다.
이 코드에 문제가되지 않습니다<?php
// get the posted data
$name = $_POST["name"];
$band_name = $_POST["band_name"];
$email = $_POST["email"];
$link = $_POST["link"];
$tracking = $_POST["tracking"];
$mixing = $_POST["mixing"];
$mastering = $_POST["mastering"];
$reamping = $_POST["reamping"];
$editing = $_POST["editing"];
$other = $_POST["other"];
$comments = $_POST["comments"];
$songs = $_POST["songs"];
$link_fb = $_POST["link_fb"];
$link_yt = $_POST["link_yt"];
$link_db = $_POST["link_db"];
// check that a name was entered
if (empty($name))
$error = "You must enter your name.";
// check that an email address was entered
elseif (empty($band_name))
$error = "You must enter your band's name.";
elseif (empty($email))
$error = "You must enter your email address.";
// check for a valid email address
elseif (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email))
$error = "You must enter a valid email address.";
elseif (empty($link_fb) && empty($link_yt) && empty($link_db))
$error = "You must enter a link to for either Facebook, Youtube or Dropbox.";
elseif (empty($tracking) && empty($mixing) && empty($mastering) && empty($reamping) && empty($editing) && empty($other))
$error = "You must check either tracking, mixing, mastering, editing or other.";
elseif (empty($comments))
$error = "You must describe your project in detail.";
elseif (empty($songs))
$error = "You must enter a total song number.";
// check if an error was found - if there was, send the user back to the form
if (isset($error)) {
header("Location: /?e=".urlencode($error)); exit;
}
// write the email content
$email_content = "Name: $name\n";
$email_content .= "Email Address: $email\n";
$email_content .= "Band Name: $band_name\n";
if (!empty($link_fb))
$email_content .= "Facebook Link: $link_fb\n";
if (!empty($link_yt))
$email_content .= "YouTube Link: $link_yt\n";
if (!empty($link_db))
$email_content .= "Dropbox Link: $link_db\n";
$email_content .= "Looking for the following services:\n\n";
if (!empty($tracking))
$email_content .= "\tTracking\n";
if (!empty($mixing))
$email_content .= "\tMixing\n";
if (!empty($mastering))
$email_content .= "\tMastering\n";
if (!empty($reamping))
$email_content .= "\tReamping\n";
if (!empty($editing))
$email_content .= "\tEditing\n";
if (!empty($other))
$email_content .= "\tOther\n\n";
$email_content .= "Songs: $songs\n";
$email_content .= "Comments:\n\n\t$comments";
// send the email
mail ("[email protected]", "Quote Request", $email_content, 'From: 456Recordings.com <[email protected]>');
// send the user back to the form
header("Location: /?s=".urlencode("Thank you for your message.")); exit;
?>
이이 문제가되지 않습니다에 저장했다,하지만 난 당신이 당신의 전체 URL을 넣어 필요하다는 것을 알고 싶은 것이라고 생각 'Location' 헤더를 사용합니다. 대부분의 브라우저는이 기능없이 작동하지만,이 방법을 따라야합니다. – Brad