Jump to content

[SOLVED] Warning: mail() [function.mail]: Failed to connect


c-o-d-e

Recommended Posts

I recieve this error on Localhost - XAMPP.

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\register.php on line 205

 

I would rather set the mailserver in php.ini

Can you give me some help on what to do?

 

EDIT:

[mail function]

; For Win32 only.

; http://php.net/smtp

SMTP = localhost

; http://php.net/smtp-port

smtp_port = 25

 

; For Win32 only.

; http://php.net/sendmail-from

;sendmail_from = [email protected]

 

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").

; http://php.net/sendmail-path

;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

 

; Force the addition of the specified parameters to be passed as extra parameters

; to the sendmail binary. These parameters will always replace the value of

; the 5th parameter to mail(), even in safe mode.

;mail.force_extra_parameters =

 

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename

mail.add_x_header = Off

 

; Log all mail() calls including the full path of the script, line #, to address and headers

;mail.log = "C:\xampp\apache\logs\php_mail.log"

 

This is in php.ini, by default.

 

Open you php.ini file (to find it's location check the value of 'Configuration File (php.ini) Path' by calling phpinfo), then change the values of SMTP and smtp_port to the correct settings for the SMTP server that you wish to use.

You need to change the localhost part of this line...

 

SMTP = localhost

 

... to be a valid SMTP server. There's no such thing as a default server. You need to either set one up, or you may have one available for use from your ISP. For example my ISP is (well used to be) NTL, they allow me to use smtp.ntlworld.com. Think of an SMTP server abit like a courier, if you wish to send a parcel (email) you need somebody to do it for you. The server you choose is down to you, continuing the analogy you would be choosing between parcel force, fed ex, the royal mail, an internal courier etc, etc.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.