开发者

SMTP configuration is not working

I have a problem at the time of sending email in php mail 开发者_Go百科function ,

It says:

SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.


Are You running on locahost..?

if you are on localhost then you need to change settings in php.ini

and it also means that your code is running successfully.


By default, PHP will try to connect to localhost on port 25 when trying to send mail. If you don't have a mail server listening on localhost then you'll get this error.

You have two options.

  1. Install an SMTP server on your PC.
  2. Tell PHP to use a different SMTP server.

If you're using Debian or Ubuntu, installing an SMTP server may be as simple as:

sudo apt-get install postfix

If you would rather use you're ISP's SMTP server, make a change to you php.ini:

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

where smtp.myisp.com is your ISP's SMTP server.


You've flagged this as PHP and described it as a PHP problem - but (as usual) there's nothing here to indicate that the problem is in PHP.

As suggested elsewhere, publish your config.

Did the facility work previously on this machine? Can you connect to the configured mail service using other SMTP clients on the same machine? What happens when you telnet to port 25? Have you verified the MTA is running?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜