0 レビュー
1 回答
php-Webフォームから情報を送信します
Webフォームからメールを送信しようとしていますが、エラーが発生します...... php環境をWindowsServer2008 R2(64ビット)スプリットサーバー(2サーバー環境)で構成しました。一方のサーバーはmysqlを実行し、もう一方のサーバーはphpとapache(xammpを使用してインストール)を実行します。 Webサイトを実行すると、次のエラーが発生します。
警告:mail()[function.mail]:「localhost」ポート25でメールサーバーに接続できませんでした。php.iniで「SMTP」と「smtp_port」の設定を確認するか、C:\ xamppでini_set()を使用してください。オンラインの\htdocs\ contact.php
以下はphpスクリプトです:
if(empty($_POST) === false) { //Array to store and output errors $errors = array(); $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $feedback = $_POST['feedback']; //check if the all the required fields have been completed if(empty($name)=== true || empty($email)=== true || empty($subject)=== true || empty($feedback) === true) { $errors[] = 'Name, email, subject and message are required'; } else { //check if the email is valid if(filter_var($email,FILTER_VALIDATE_EMAIL) === false ) { $errors[] = 'That\'s not a valid email address'; } //check if the name contains any numbers if (ctype_alpha($name)=== false) { $errors[] = 'Name must only contain letters'; } } } //if there are no errors then send the email if(empty($errors) === true) { //send email mail('[email protected]','$subject','$feedback','FROM:'.'$email'); //redirect users header('Location: contact.php?sent'); //exit(); }
以下はphp.iniファイルからのものです:
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = [email protected]
私はまだphpを理解しているので、誰かが私が間違っていることを理解するのを手伝ってくれるといいですね
わからない
0
レビュー
答え :
解決策:
ローカルマシンでsendmailサーバーを実行しましたか?
テストの目的で、
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。