0

hello, im using a wamp server and i want to sent an email and after writting the code, im getting an error that says 'warning: mail() [function.mail]: failed to connect to mail server at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set().'
Im not familiar with the php.ini file so i need help to fix this error.

3
Contributors
5
Replies
10
Views
5 Years
Discussion Span
Last Post by LastMitch
0

@James singizi

warning: mail() [function.mail]: failed to connect to mail server at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set().'

It means look in your php.ini for the SMTP.

In order to use the mail() function you must setup the php.ini parameters correctly.

Another words, you have to setup the SMTP correctly on your php.ini.

If you don't understand just post the code

I mean your mail() function and your php.ini code

Edited by LastMitch: grammer

1

my php.ini is as follows:
[mail function];
For win 32 only.
SMTP=localhost
smtp_port = 25;
For win 32 only.
Sendmail_from=you@yourdomain

Votes + Comments
It will works for localhost with out ssl connection
0

I didn't think you could set up a local server with email unless you have an email client to handle this.
you could try setting it in your email file code: phpini_set("sendmail_from", "info@mydomain.com"). I heard this works

0

@James singizi

i have tried this and it didnt work, im still getting the same error

my php.ini is as follows:
[mail function];
For win 32 only.
SMTP=localhost
smtp_port = 25;
For win 32 only.
Sendmail_from=you@yourdomain

There's nothing wrong with the code. I think you don't SMTP server installed on your server.

You can used phpmailer or Pear Mail package or swiftmailer

So your PHP installed has invalid mail settings because it wasn't configuring correctly so that's why it didn't work.

Install either package from above, just installed only one and test it out and it will work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.