我知道關於smtp,1and1託管和Zend Framework已經有很多問題了。我一直在閱讀它們幾個小時,但一無所有(也許我已經省略了最重要的一個?)。所以,讓我們切入正題:使用Zend Framework從1and1 smtp服務器發送郵件
- 我越來越一遍又一遍的 同樣的錯誤「消息:連接 拒絕「,不管我什麼SMTP 嘗試使用。我明白與如Gmail外服務器(這我也試過),但的1and1 SMPT,有可能是問題...
我使用相當普遍的配置:
email.configTransport.auth =「登錄」 email.configTransport.username = 「[email protected]」 email.configTransport.password = 「密碼」 email.configTransport.host = 「smtp.1and1.pl」
然後在引導我設置默認傳輸:
protected function _initDefaultEmailTransport(){
$configTransport = $this->getOption('email');
$tr = new Zend_Mail_Transport_Smtp($configTransport['configTransport']['host'],
$configTransport['configTransport']);
Zend_Mail::setDefaultTransport($tr);
}
- 有趣的是它最有效的工作 我的本地主機(也通過Thunderbird)。所以我覺得配置是好的,smtp服務器的作品。
- 我一直在嘗試端口25和587. 同樣的問題。 如果我更改了錯誤的密碼,我又得到了同樣的錯誤,所以看起來我在連接階段遇到了問題,不是嗎?
我會很樂意爲任何想法可能是錯誤的。
我沒有看到它可以被覆蓋的地方。除此之外,我嘗試了生產和開發配置。 OpenSSL已經啓用,我已經檢查過了。這是我的配置文件。
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutpath = APPLICATION_PATH "/layouts/scripts/"
autoloaderNamespaces[] = "Doctrine"
doctrine.dsn = "mysql://...."
doctrine.data_fixtures_path = APPLICATION_PATH "/../doctrine/data/fixtures"
doctrine.models_path = APPLICATION_PATH "/models"
doctrine.migrations_path = APPLICATION_PATH "/../doctrine/migrations"
doctrine.sql_path = APPLICATION_PATH "/../doctrine/data/sql"
doctrine.yaml_schema_path = APPLICATION_PATH "/../doctrine/schema"
doctrine.generate_models_options.pearStyle = true
doctrine.generate_models_options.generateTableClasses = true
doctrine.generate_models_options.generateBaseClasses = true
doctrine.generate_models_options.baseClassPrefix = "Base_"
doctrine.generate_models_options.baseClassesDirectory =
doctrine.generate_models_options.classPrefixFiles = false
doctrine.generate_models_options.classPrefix = "Application_Model_"
resources.mail.transport.type = "smtp"
resources.mail.transport.host = "smtp.gmail.com"
resources.mail.transport.auth = "login"
resources.mail.transport.ssl = "tls"
resources.mail.transport.username = "username"
resources.mail.transport.password = "pass"
resources.mail.transport.register = true
autoloaderNamespaces[] = "ZC"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
下面是完整的錯誤信息:
Stack trace:
#0 /homepages/46/d339149978/htdocs/library/Zend/Mail/Protocol/Smtp.php(167): Zend_Mail_Protocol_Abstract->_connect('tcp://smtp.gmai...')
#1 /homepages/46/d339149978/htdocs/library/Zend/Mail/Transport/Smtp.php(199): Zend_Mail_Protocol_Smtp->connect()
#2 /homepages/46/d339149978/htdocs/library/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#3 /homepages/46/d339149978/htdocs/library/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#4 /homepages/46/d339149978/htdocs/application/controllers/ContactController.php(97): Zend_Mail->send()
#5 /homepages/46/d339149978/htdocs/application/controllers/ContactController.php(74): ContactController->sendContactMail(Array)
#6 /homepages/46/d339149978/htdocs/library/Zend/Controller/Action.php(513): ContactController->sendAction()
#7 /homepages/46/d339149978/htdocs/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('sendAction')
#8 /homepages/46/d339149978/htdocs/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 /homepages/46/d339149978/htdocs/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#10 /homepages/46/d339149978/htdocs/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#11 /homepages/46/d339149978/htdocs/public/index.php(27): Zend_Application->run()
#12 {main}
上週日我已經發送一封郵件到的1and1詢問是否有通過SMTP發送電子郵件的任何問題。今天我收到一個答案,說一切正常,我必須檢查我的腳本...
它再次在本地工作,但在線服務器返回錯誤...無論如何感謝您的幫助。 – 2011-04-10 13:10:56
@約書亞樹,檢查我的編輯。 – 2011-04-10 15:44:31
請參閱我的編輯。 – 2011-04-12 16:44:18