c-o-d-e Posted November 19, 2009 Share Posted November 19, 2009 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. Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/ Share on other sites More sharing options...
cags Posted November 19, 2009 Share Posted November 19, 2009 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. Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961048 Share on other sites More sharing options...
c-o-d-e Posted November 19, 2009 Author Share Posted November 19, 2009 I posted in origional post as Edit, the mail settings. How do I find out my default settings for it? Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961050 Share on other sites More sharing options...
cags Posted November 19, 2009 Share Posted November 19, 2009 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. Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961064 Share on other sites More sharing options...
c-o-d-e Posted November 19, 2009 Author Share Posted November 19, 2009 I run the server on localhost, as its not on the net yet. (development server) Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961073 Share on other sites More sharing options...
cags Posted November 19, 2009 Share Posted November 19, 2009 That has very little, if anything, to do with a mail server. Are you saying you have installed a mail server? Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961082 Share on other sites More sharing options...
mrMarcus Posted November 19, 2009 Share Posted November 19, 2009 you then need to have a mail server installed on your localhost (on your computer/home server) if you do not have a Host. Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961085 Share on other sites More sharing options...
c-o-d-e Posted November 19, 2009 Author Share Posted November 19, 2009 Well, I installed XAMPP as it is, I'm not sure if it comes with a Mail Server. I'll install one, where would I install it? in XAMPP htdocs (where my site files is) or where? Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961091 Share on other sites More sharing options...
c-o-d-e Posted November 19, 2009 Author Share Posted November 19, 2009 - XAMPP Has Mercury installed. Mailing works. Link to comment https://forums.phpfreaks.com/topic/182155-solved-warning-mail-functionmail-failed-to-connect/#findComment-961112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.