Question:
PHP mail function?
lahiru
2014-07-16 06:52:50 UTC
hi,

i have a php file host in a server (not localhost) that able to send a email when a email address is provided.

but it`s not work.

mail("email@email.com","test","test","test");

this is the function i used.

it return true after i run it.

but i can`t find email in inbox.

i have spent more time with this problem.

so please help me to make this error.

thank you.
Three answers:
Andrew S
2014-07-16 07:18:18 UTC
At first guess I would imagine this is a server configuration issue. PHP doesn't actually send the message itself, rather it passes it to a helper application to be sent. If mail isn't configured on the server that will fail so you'll need to get email up and running on that machine.



The other alternative is that it is calling the wrong program or with the wrong options in which case you'll need to adjust your php.ini to suitable settings. The fourth parameter of mail() is for additional parameters to that helper, so you are giving it an additional argument "test" which may well confuse it in any case. Generally the last two parameters should be simply left out unless there is a clear reason to include them.



Regardless, your server error logs will probably give you some useful information and should be the first thing you check..
Chris
2014-07-16 07:14:36 UTC
You should remove the third "test", which is for additional header info.
?
2014-07-16 06:55:13 UTC
Check spam folder.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...