0

私の会社に電子メールを送信し、フォームに記入したユーザーに別の電子メールを送信するフォームを持つサイトがあります。すべての追加ファイルを含むサイトをサーバーにロードしましたが、フォームに入力してテストすると、「見つかりません」というエラーが表示されます。私はそれを処理するためにPHPのGETメソッドを使用しています。私はPHPとWebデザイン全般に不慣れです。ありがとうございました。

<?php
//Function that sends the email to the person who submitted the form
function send_email(){
//This sends an email to the person who submitted the form
// email fields: to, from, subject. Put your values here!
$sendermail = 'company@email.com';
$from = "Company<".$sendermail.">";
$to = $_GET['email'];
$subject = 'Product Information';
$message = "A member of our sales team will be getting back to you shortly.  Thank you for your interest in our great line of products."."\n\n"."Best Regards,"."\n\n"."The Team";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\n";
$headers .= 'From: '. $from . "\r\n" .
'Reply-To: '. $sendermail. "\r\n" .
'X-Mailer: PHP/' . phpversion();

$ok = @mail($to, $subject, $message, $headers);

//This sends the contents of the form submission to the website owner
$sendermail2 = $_GET['email'];
$from2 = $_GET['first-name'].' '.$_GET['last-name'].' <'.$sendermail2.'>';
$to2 = 'company@email.com';
$subject2 = 'A customer submission from the product page';
$message2 = "Name: ". $_GET['first-name'] ." ". $_GET['last-name'] ."\n\n". "Company: ". $_GET['company'] ."\n\n". "Email: ". $_GET['first-name'] ."\n\n". "Interest: ".$_GET['Interest'];
$headers2  = 'MIME-Version: 1.0' . "\r\n";
$headers2 .= 'Content-type: text/plain; charset=iso-8859-1' . "\n";
$headers2 .= 'From: '. $from2 . "\r\n" .
'Reply-To: '. $sendermail2. "\r\n" .
'X-Mailer: PHP/' . phpversion();

$ok2 = @mail($to2, $subject2, $message2, $headers2);
}
return send_email();
?>

...そして、このコードは HTML ページの本文にあります。

<FORM ACTION="http://www.server.com/html/form_process.php" METHOD=GET>
4

2 に答える 2

0

見つからないというエラーは通常、フォームを間違った URL に送信していることを意味します。送信先の URL と php ファイルへのパスを確認して、それらが正しいかどうかを確認します。

于 2013-07-18T20:21:21.197 に答える
0

Red Hat サーバーのソリューション:

sudo yum install postfix

続いて:

sudo echo "sendmail_from = me@example.com" >> /your/directory/php.ini

そして最後に:

sudo echo "sendmail_path = /usr/sbin/sendmail -t -i -f me@example.com" >> /your/directory/php.ini

/your/directory/php.ini を実際の php.ini ディレクトリに置き換え、me@example.com を必要なメール アドレスに置き換えて、apache、php、postfix を再起動するか、サーバーを直接起動します。

于 2013-07-18T20:03:34.733 に答える