Log in

View Full Version : Function.Mail?



alexjewell
07-19-2006, 07:00 PM
I have a website for a client, and it has two forms.
They use the mail() function to send the feedback to his inbox.
I'm getting this error when the form is submitted:

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 d:\webspace\ADMIN\zollie.net\WWW\contact.php on line 33

The form is at www.zollie.net/contact.php, and the form submits to contact.php?form=send.

I know I have to somehow fix this issue with ini_set since I don't have access to php.ini.

Any feedback would be greatly appreciated?
Thanks

Twey
07-19-2006, 08:10 PM
Read the INI documentation in the PHP mail (http://www.php.net/mail) documentation. On Windows, you need to specify an appropriate mail server.

alexjewell
07-19-2006, 09:18 PM
thanks for that
but I'm still confused?
I still am not sure as to how to fix the issue
How do I find out what mail server to specify
and how do I specify the particular mail server?

Twey
07-19-2006, 09:28 PM
It depends on the domain from which you wish to send emails. If you use an @yahoo.com address, for example, the server would be smtp.yahoo.com:25, which is Yahoo!'s SMTP server. The server is the same as the SMTP server you use when you set up your email client to work with that provider.

alexjewell
07-20-2006, 02:36 AM
Ok, so...
uh...
so if the form is submitting to alexjewell@sbcglobal.net, it will just be smpt.sbcglobal.net:25?

ok

so then how do I specify that in the php code, then?

Twey
07-20-2006, 12:22 PM
Not necessarily. It's the address it's submitting *from*, not to. The usual convention is smtp.<providerdomain>:25, but that doesn't have to hold true. As I said, it's the same server you used to set up your email client. When you've figured it out, the code is, for example:
ini_set('SMTP', 'smtp.sbcglobal.net');
ini_set('smtp_port', '25');

alexjewell
07-20-2006, 02:54 PM
Ok, now I understand.
So, somehow when the user submits the form, I have to get their email address' ending and throw it into that.
ok
let's see how that goes

Twey
07-21-2006, 04:31 AM
No! You need to set it up to use an SMTP server on which you have an account.