1
私はphpメーラー経由で電子メールを送信しようとしているときにエラーに直面しています。私は電子メールを送信するための次のコードを持っています。このエラーを修正するには504 - GATEWAY TIMEOUT?
require_once 'PHPMailer/PHPMailerAutoload.php';
$response = array();
//Create a new PHPMailer instance
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = "mail.example.com";
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = "*****@Example.com";
$mail->Password = "*******";
$mail->setFrom($to, $name);
$mail->addAddress('*****', '***');
$mail->Subject = $subject;
$message = '*******';
$mail->msgHTML($message);
$mail->AltBody = 'This is a plain-text message body';
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
if (!$mail->send()){
// For Debugging
//return "Mailer Error: " . $mail->ErrorInfo;
$response['error'] = 'Something not right. Please check your details.';
}else{
$response['success'] = 'Your email has been sent successfully.';
}
echo json_encode($response, JSON_PRETTY_PRINT);
上記のコードはcontact.phpファイルの中にあり、私はform.phpファイルからajaxに近づいています。しかし、それは多くの時間がかかり、最後にはエラーを示しています。
Why am I seeing this page?
The server that your request has reached is acting as a gateway or proxy to fulfil the request made by your client.
Web Browser => Web Front-End => Web Back-End
This server (Web Front-End) received an invalid response from an upstream (Web Back-End) server it accessed to fulfil the request.
In most cases this will not mean that the upstream server is down, but rather that the upstream server and the gateway/proxy do not agree on the protocol for exchanging data.
This problem is most commonly caused when there is a problem with IP communications between the Web Front and Back-Ends. Before you attempt to resolve this problem you should clear your browser cache completely.
Our support staff will be happy to assist you in resolving this issue. Please contact our Live Support or reply to any Tickets you may have received from our technicians for further assistance.
誰かが親切にそれを修正する方法を教えてもらえますか?
私は 'SMTPDebug = 3'を設定してこれはブラウザではなくコマンドラインから実行されます。あなたのWebサーバーはあなたにエラーを見せつけています。 – Synchro