1

ラジオ ボタンと送信ボタンを含む電子メールが顧客に送信され、PHP を含む Wordpress ページに誘導され、詳細が記載された電子メールがサポート チームに送信されるシステムをセットアップしようとしています。wordpress に exec_php をインストールし、Web で見つけたものを変更した PHP スクリプトを使用しましたが、考えられるすべてをチェックしたにもかかわらず、PHP の一部が実行されているにもかかわらず、メールが返信されません。

wordpress ページの PHP:

<?php if($_SERVER["REQUEST_METHOD"] == "POST")
{
$to = "example@gmail.com";
$from = "no-reply@oursite.co.uk";
$resolved = $_POST['yesno'];
if ($resolved=='This issue was resolved.')
{$body = $_POST['cust'] . "has responded to an email asking for feedback regarding the closure of case number" . $_POST['casesendid'] . "The person in question responded that they are satisfied with the resolution. Please do not reply to this email.";}
else
{$body= $_POST['cust'] . "has responded to an email asking for feedback regarding the closure of case number" . $_POST['casesendid'] . "The person in question responded that they are not satisfied with the resolution. Please do not reply to this email.";}
$subject = "Automated Feedback Message";
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
$SMTPChat = $SMTPMail->SendMail();
}
echo $resolved;
?>

このページのテンプレートには、同じディレクトリの「settings.php」にある 2 つのファイルへの php インクルードが含まれています。

<?php
//Server Address
$SmtpServer="smtp.hosts.co.uk";
$SmtpPort="25"; //default
$SmtpUser="oursite.co.uk";
$SmtpPass="password";
?>

そしてmailclass.phpで:

<?php
class SMTPClient
{

function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)
{

$this->SmtpServer = $SmtpServer;
$this->SmtpUser = base64_encode ($SmtpUser);
$this->SmtpPass = base64_encode ($SmtpPass);
$this->from = $from;
$this->to = $to;
$this->subject = $subject;
$this->body = $body;

if ($SmtpPort == "")
{
$this->PortSMTP = 25;
}
else
{
$this->PortSMTP = $SmtpPort;
}
}

function SendMail ()
{
if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
{
fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n");
$talk["hello"] = fgets ( $SMTPIN, 1024 );
fputs($SMTPIN, "auth login\r\n");
$talk["res"]=fgets($SMTPIN,1024);
fputs($SMTPIN, $this->SmtpUser."\r\n");
$talk["user"]=fgets($SMTPIN,1024);
fputs($SMTPIN, $this->SmtpPass."\r\n");
$talk["pass"]=fgets($SMTPIN,256);
fputs ($SMTPIN, "MAIL FROM: <".$this->from.">\r\n");
$talk["From"] = fgets ( $SMTPIN, 1024 );
fputs ($SMTPIN, "RCPT TO: <".$this->to.">\r\n");
$talk["To"] = fgets ($SMTPIN, 1024);
fputs($SMTPIN, "DATA\r\n");
$talk["data"]=fgets( $SMTPIN,1024 );
fputs($SMTPIN, "To: <".$this->to.">\r\nFrom: <".$this->from.">\ \nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n");
$talk["send"]=fgets($SMTPIN,256);
//CLOSE CONNECTION AND EXIT ...
fputs ($SMTPIN, "QUIT\r\n");
fclose($SMTPIN);
//
}
return $talk;
}
}
?>

すべてのパスワードとユーザー名フィールドには実際の詳細が入力され、ページにリダイレクトされると、$resolved の正しい値が表示され、php が実行されることを示唆していますが、$to アドレスでメールが受信されることはありません。これは悪夢に変わっているので、誰か提案があれば助けてください。

4

0 に答える 0