0

I encounter an error message when I click on my submit button.
The error is:

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:\wamp\www\Duplicate of Edited Site\question.php on line 17

Line 17 contains the if statement, it is where the error was pinpointed:

if(!mail("little_saint1321@yahoo.com", "Inquiry", $message, "Cc: $email\r\n"))
			{
				echo"Sending failed.";
			}
			else
			{
				echo"Message sent.";
			}

Help please.

5
Contributors
21
Replies
22
Views
8 Years
Discussion Span
Last Post by rafaelcarioca7
0

Hi, thanks for a response.

Well, I tried checking phpinfo() tools. The values that i can only see under SMTP Local Value is localhost Master Value is localshot, and in the smtp_port is Local Value is 25 and Master Value is 25.

I can't see an option to enable it. Any more?

0

are you using windows or linux?
because I have never gotten this error in linux (if SMTP is not set-up then it just doesn't send, for me anyway), but I've seen around the web that windows can be a bigger problem.

and sorry about the phpinfo() I see now that it doesn't actually say if it is enabled or disabled, just where it'll try to send it to.
You could always try to set these values to an smtp server you know will work, possibly google or your ISP's smtp server.

0

I'm actually using windows. Problem is i don't know how to set this SMTP's with google or with other ISP server. whew.

0

when you look at your phpinfo() page there is one field that says 'Loaded Configuration File'. In that file there are the SMTP and smtp_port (comment above says for Win32 only) and there you can choose which smtp server you would like to use.

If you have a gmail account you might be able to enable the pop3 forwarding option (if that is even necessary) and use smtp.gmail.com, otherwise your ISP probably also has an smtp server (usually something like smtp.yourisp.com or mail.yourisp.com). I hope this helps at all...

0

Are you using wamp? If yes, i get the same error too :D

Yup, i'm using wamp 2.0f Having a problem in setting up the IIS of wamp, i think it's in the APACHE, cuz' APACHE servers as the IIS of wamp.. not sure though.

I tried installing the Internet Information Services of Windows but it causes a conflict with WAMP, once you start running wamp it causes something like an interruption error.

Edited by JerieLsky: n/a

0

Hi ryuslash,

this is a part of the php.ini file which is in the SMTP section:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = you@yourdomain

i think this is what you were referring to, so what am i going to edit in there? the php.ini file is actually a text file.

0

Hi ryuslash,

this is a part of the php.ini file which is in the SMTP section:


i think this is what you were referring to, so what am i going to edit in there? the php.ini file is actually a text file.

i suggest you install a mail server first.

for our test environment we used this mail server

http://www.kerio.com/mailserver/download

0

Hi ryuslash,

this is a part of the php.ini file which is in the SMTP section:


i think this is what you were referring to, so what am i going to edit in there? the php.ini file is actually a text file.

Yes most ini files look just like test files, this eases editing, if they encrypted it or even made it binary you'd have more trouble reading and editing it ;)

you would edit

SMTP = mail.yourisp.com
smtp_port = 25 ;(default port, should work)

sendmail_from = [email]your@emailaddress.here[/email]

Yup, i'm using wamp 2.0f Having a problem in setting up the IIS of wamp, i think it's in the APACHE, cuz' APACHE servers as the IIS of wamp.. not sure though.

I tried installing the Internet Information Services of Windows but it causes a conflict with WAMP, once you start running wamp it causes something like an interruption error.

I've never used WAMP (always did a manual install of apache and php, and only much later easyphp), never liked IIS, but it might be a port problem (i.e. WAMP trying to run on port 80 and IIS running on port 80, one will say port 80 is taken). Maybe...

0

Hi, to ivanatako, :p i actually don't know how to use that mailserver that you gave me. :D I don't know what changes to make on that software. :D

Help me please? :D

0

You shouldn't need your own mail server if you use someone else's smtp server though, right?

0

Hi, to ivanatako, :p i actually don't know how to use that mailserver that you gave me. :D I don't know what changes to make on that software. :D

Help me please? :D

start the mail server, then create an account there.. and on your php.ini change its value

SMTP = localhost
smtp_port = 25 ;(default port, should work)
sendmail_from = your@emailaddress.here

now, test it. You should always send it on a local mail account not on an external mail like gmail,yahoo or hotmail.. after all, its only for testing purposes right?

0

You shouldn't need your own mail server if you use someone else's smtp server though, right?

yes he might not need a mail server but to what i see on this situation, his just testing this locally so where could he get other smtp?

if he'll use gmail smtp then he'll be needing phpmailer.

0

yes he might not need a mail server but to what i see on this situation, his just testing this locally so where could he get other smtp?

if he'll use gmail smtp then he'll be needing phpmailer.

So just setting the smtp server to gmail's smtp server or his isp's smtp server won't actually work? :S
Makes me so glad I've got linux ^_^

0

So just setting the smtp server to gmail's smtp server or his isp's smtp server won't actually work? :S
Makes me so glad I've got linux ^_^

yeah i agree.. its better with linux.. if you'll be using gmail's smtp then i bet you'll be needing phpmailer for it to work. Tried that before but never really been to able to make it work without phpmailer. Maybe i was wrong? is it possible?

0

Ahm, SMTP server? like yahoo.com? are you referring to those?

yes cause i bet your not connected to a network with mail server :)

Edited by ivatanako: n/a

0

start the mail server, then create an account there.. and on your php.ini change its value

SMTP = localhost
smtp_port = 25 ;(default port, should work)
sendmail_from = your@emailaddress.here

now, test it. You should always send it on a local mail account not on an external mail like gmail,yahoo or hotmail.. after all, its only for testing purposes right?

Yes, for now it's just for testing purposes, but what I'm having a problem would be, if I deploy this site am I still going to have the same errors? Hmm.. How do you use the phpmail?

0

Yes, for now it's just for testing purposes, but what I'm having a problem would be, if I deploy this site am I still going to have the same errors? Hmm.. How do you use the phpmail?

no, if your going to deploy it then make sure that the host has smtp enabled and most web host has this one on.

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.