您好我正在尝试从Zend_Mail模块通过gmail发送一些电子邮件。 这是我的代码:
$config = array(
'ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'webmaster@mydomain.com',
'password' => 'password'
);
$smtpConnection = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
错误:
警告:stream_socket_enable_crypto()[streams.crypto]:此流不支持206行/library/Zend/Mail/Protocol/Smtp.php中的SSL /加密 无法通过TLS连接
我尝试告诉我的托管服务提供商在phi.ini中启用openssl.dll
但他们说没有必要,因为服务器在Linux中,并且不需要启用openssl.dll来使用TLS或SSL。
我的托管服务提供商是错误的还是我在代码中做错了什么。
提前致谢
Fabian
答案 0 :(得分:12)
openssl.dll是windows openssl扩展。
在Linux上,您需要使用OpenSSL支持编译PHP。 http://www.php.net/manual/en/openssl.installation.php
您需要OpenSSL for PHP套接字和流功能才能使用TLS。 Zend使用这些功能,因此需要相同的功能。
答案 1 :(得分:6)
我遇到类似的问题是有效的; 使用Zend邮件传输和yahoo smtp:
$mailhost= 'smtp.example.com';
$mailconfig = array(
'auth' => 'login',
'username' => 'me@example.com',
'password' => 'topsecret',
'port' => '465',
'ssl' => 'ssl'
);
$transport = new Zend_Mail_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
这产生了一个错误:“权限被拒绝”并且没有发送邮件。在尝试了所有解决方案三周后,我发现有效的解决方案正在发生变化:
$运输到;
$transport = new Zend_Mail_Transport_Sendmail('-fsupport@website.com',$mailhost, $mailconfig);
按预期工作......
答案 2 :(得分:2)
答案 3 :(得分:0)
尝试将ssl://设置为主机名的前缀,并使用465作为端口。
答案 4 :(得分:0)
经过数小时的故障排除,更改 'ssl' => 'tls' 到 'ssl' => 'ssl'
为我工作。它在以前的服务器中运行良好。移动到新服务器后,tls 错误statrted。