简体   繁体   中英

send email from wamp and proxy

it's two days that I'm trying to send email from my php application running on my PC with WAMP. I modified the php.ini in this way:

[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

When I try to send an email I get this error:

Warning: mail(): Failed to connect to mailserver 

I also tried with win sendmail but it time out every time. The reason is that I'm behind a proxy. Infact this is working:

$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);

How can I set wamp to use the proxy?

Thanks

First of all:

smtp_port = 26

looks incorrect. Usually, SMTP runs on port 25 . Is your smtp server running on port 26 ?

Can you actually ping the server? You can try to telnet to mail.myisp.org and use port 25 or 26 and see if you can connect.

Check also your Internet Properties. Go to Connections tab, LAN settings and put your proxy server settings there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM