0

PHP 経由で送信する連絡フォームがありますが、転送先のメール アドレスに送信するのに問題があります。

私のサイトは iPage でホストされており、iPage の MX レコードは、私の電子メールとドメインが登録/管理されている Hover を指しています。私は Hover でメール転送 (myname@mysite.com、何年も使用してきたメールに転送する) しか設定していませんが、それは魅力的に機能します。myname@mysite.com の電子メールに送信されたすべての電子メールは、私がずっと持っていた電子メールの受信トレイに直接送信されます。

しかし、自分のサイトの php 連絡フォームがメールに情報を取得していません。「to」フィールドを、ずっと使ってきたメールに送信するように設定すると、連絡先フォームから直接メールに送信されます。ただし、myname@mysite.com の電子メールを「宛先」フィールドとして使用すると、連絡先フォームが受信ボックスに届きません。

phpファイルは次のとおりです。

<?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 ("brian@456recordings.com", "Quote Request", $email_content, 'From: 456Recordings.com <webmaster@456recordings.com>' );  

// send the user back to the form  
header("Location: /?s=".urlencode("Thank you for your message.")); exit;  

?>
4

1 に答える 1