Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从wamp和代理发送电子邮件_Php_Proxy_Wamp_Sendmail - Fatal编程技术网

Php 从wamp和代理发送电子邮件

Php 从wamp和代理发送电子邮件,php,proxy,wamp,sendmail,Php,Proxy,Wamp,Sendmail,两天来,我一直在尝试用WAMP从我的PC上运行的php应用程序发送电子邮件。 我以这种方式修改了php.ini: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = mail.myisp.org ; http://php.net/smtp-port smtp_port = 26 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = admin@m

两天来,我一直在尝试用WAMP从我的PC上运行的php应用程序发送电子邮件。 我以这种方式修改了php.ini:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.myisp.org
; http://php.net/smtp-port
smtp_port = 26

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = admin@myisp.org
auth_username = admin@myisp.org
auth_password = mySuperSecretPWD
当我尝试发送电子邮件时,出现以下错误:

Warning: mail(): Failed to connect to mailserver 
我也尝试了win sendmail,但每次都超时。原因是我支持一个代理。事实上,这是有效的:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.google.com');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:3128');
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);

curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_REFERER, 'http://google.com');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla...');

$result = curl_exec($ch);
$info = curl_getinfo($ch);
$error = curl_error($ch);
var_dump($result);
var_dump($info);
var_dump($error);
curl_close($ch);
如何设置wamp以使用代理

首先,谢谢你:

smtp_port = 26
看起来不正确。通常,SMTP在端口25上运行。您的smtp服务器是否在端口26上运行

你真的能ping服务器吗?您可以尝试telnet到mail.myisp.org并使用端口25或26,看看是否可以连接

还要检查您的Internet属性。转到连接选项卡,LAN设置,并将代理服务器设置放在那里