我想在joomla網站建立一個聯繫表單模塊。聯繫人模塊非常適合我的每個個人電子郵件地址,例如[email protected]或[email protected]等。但是當我用我的客戶的公司郵件收件人測試它時,郵件功能會失敗。PHP郵件的作品,但我無法發送郵件到公司郵箱
爲了獲得約我設置mailsender屬性,以我個人的郵件地址失敗一些更多的信息如下:
$mailSender->setSender('[email protected]');
$mailSender->addReplyTo('[email protected]');
,這就是我得到:
在收到原始郵件太陽,2012年10月21日15:05:00 +0200 從阿帕奇@本地
-----下列地址擁有永久致命錯誤-----
[email protected]
(reason: 553 5.3.0 <[email protected]>... No such user here)
(expanded from: [email protected])
-----答問全文如下-----
... while talking to [127.0.0.1]:
>>> DATA
<<< 553 5.3.0 <[email protected]>... No such user here
550 5.1.1 [email protected] User unknown
<<< 503 5.0.0 Need RCPT (recipient)
,並在附件中這樣的:
Reporting-MTA: dns; xxxxxx.yyyyyyy.com
Arrival-Date: Sun, 21 Oct 2012 15:05:00 +0200
Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.3.0
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 553 5.3.0 <[email protected]>... No such user here
Last-Attempt-Date: Sun, 21 Oct 2012 15:05:01 +0200
看來公司的webmail不接受郵件來自它自己的服務器。 我不是一個電子郵件專家,也不是一個專業的PHP程序員。 有什麼想法?
遵循其中的郵件功能instatiated並推出了我的Joomla模塊的一部分:
$mailSender = &JFactory::getMailer();
$mailSender->addRecipient($recipient);
$mailSender->setSender('[email protected]');
$mailSender->addReplyTo('[email protected]');
$mailSender->setSubject('Richiesta informazioni da sito web');
$mailSender->setBody($myMessage);
if ($mailSender->Send() !== true) {
$myReplacement = '<span style="color: ' . $error_text_color . ';">' . $errorText . '</span>';
//header("Location: $url",303);
print $myReplacement;
return true;
}
else {
$myReplacement = '<span style="color: '.$thanksTextColor.';">' . $pageText . '</span>';
print $myReplacement;
return true;
}
我沒有控制網絡郵件,也沒有我的客戶公司的服務器我只有ftp訪問我目前正在製作的網站的根目錄。 我可以使用php腳本進行測試嗎? – user1761575
不幸的是,您需要root或sudo訪問才能更改該文件。 – doublesharp
另一種選擇是*不*通過本地主機SMTP服務器發送郵件。你確實失去了一些健壯性(如果你的Web服務器無法到達郵件服務器),但它應該工作。很難說主機是什麼,但可能是mail.example.com或smtp.example.com。相應地更新 – doublesharp