PEAR Mail.php ライブラリを使用したフォーム処理スクリプトを、あるサイトから PHP5 内の別のサイトに移行する作業を行っています。スクリプトはこのメッセージの下部に貼り付けられています。すべてがうまくいっているようです。スクリプトでこれを使用しても、PHP エラーは発生しません。
error_reporting(E_ERROR | E_WARNING | E_PARSE);
しかし、ブラウザーの結果は、PEAR によって返された PEAR エラー状態を示しています。
"An email error has occurred..."
これは、スクリプトでの結果です。
if (PEAR::isError($mail2)) {
これは、この PEAR エラーに関する詳細を見つける方法がわかりません。PEAR による何らかの明示的なエラー メッセージを有効にする方法はありますか?
以下のコードに関するアドバイスはありますか?
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Relies on PEAR Mail module!
require_once "Mail.php";
if (isset($_REQUEST['pdfName']) && isset($_REQUEST['pdfEmail'])) {
$name = $_REQUEST['pdfName'];
$email = $_REQUEST['pdfEmail'];
$file = $_REQUEST['pdfFile'];
$host = 'smtpout.secureserver.net';
$user = 'ot@domain.com';
$pass = 'password';
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $user,
'password' => $pass));
$to = "info@domain.com";
$Bcc = "dan@domain.com";
$recipients = $to.", ".$Bcc;
$from = "info@domain.com";
$subject = "Document request on company.com";
$body = "Hello Sales Team,
Name: $name
Email: $email
Requested the file: http://en.domain.com/docs/$file";
$headers = array ('From' => $from,
'To' => $to,
'Bcc' => $Bcc,
'Subject' => $subject);
$mail = $smtp->send($recipients, $headers, $body);
$to = $email;
$from = "info@domain.com";
$subject = "company Your document is here";
$body = "Hello $name,
The document you requested one http://www.domain.com can be found here:
http://en.domain.com/docs/$file
Enjoy the information.
If you have questions, do not hesitate to contact us.
E-Mail: info@domain.com
Tel: +1 (000) 606 4000 (US office)
Kind regards
The company Team
www.domain.com
The information contained in this email is intended only for the use of the person or entity to whom it is addressed and may contain information that is confidential and maybe legally privileged and exempt from disclosure under applicable laws. If you read this message and are not the addressee, you are notified that use, dissemination, distribution or reproduction of this message is legally prohibited. If you have received this message in error, please notify us immediately and return the original message to us.";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$mail2 = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail2)) {
//echo("<p>" . $mail2->getMessage() . "</p>");
echo("<tr>
<td colspan='2' style='margin:10px 0 20px 10px;'>
<div style='margin:10px 0 2px 5px;color:#01578C;'>An email error has occurred.</div>
<div style='margin:0 0 20px 5px;'>Please provide a valid email address so we can send you a link to the requested document.</div></td>
</tr>
<tr>
<td align='left' valign='top' style='width: 350px;'><span style='padding-left:5px' >Please submit a new request.</span></td>
<td style='padding:2px 5px;'><div style='height:109px;'> </div></td>
</tr>");
} else {
echo("<tr>
<td colspan='2' style='margin:10px 0 20px 10px;'>
<div style='margin:10px 0 2px 5px;color:#01578C;'>Your data were sent successfully.</div>
<div style='margin:0 0 20px 5px;'>A link to the requested document was sent to the email address you provided.</div></td>
</tr>
<tr>
<td align='left' valign='top' style='width: 350px;'><span style='padding-left:5px' >Enjoy the information.</span>
<P>
<br>
<A HREF=\"javascript:history.go(-2)\">Click here to go back to browsing company.com.
</td>
<td style='padding:2px 5px;'><img align='left' alt='' src='/docdown/index-files/whitepaper.jpg'/></td>
</tr>
");
}
} else {
echo("<tr>
<td colspan='2' style='margin:10px 0 20px 10px;'>
<div style='margin:10px 0 2px 5px;color:#01578C;'>
An error has occurred.</div>
<div style='margin:0 0 20px 5px;'>Please provide a valid email address so we can send you a link to the requested document.</div></td>
</tr>
<tr>
<td align='left' valign='top' style='width: 350px;'><span style='padding-left:5px' >Please submit a <A HREF=\"javascript:history.go(-1)\"> new request on the previous page.</a></span></td>
<td style='padding:2px 5px;'><div style='height:109px;'> </div></td>
</tr>");
}
?>