Page 1 of 1
Emailing through PHP
Posted: Mon Sep 11, 2006 12:52 am
by wqr786
I use
but this code is not working on my server.
I try it like this:
Code: Select all
if(mail($variables.....))
{
echo "mail sent";
}
else
echo "not sent";
please provide me with code properly working. i think there's some smtp problem, but can't figure out. smtp is running on my local server. if you could make one single file which has code and sends email, please let me know.\
Posted: Mon Sep 11, 2006 2:40 am
by n00b Saibot
wqr786 wrote:please provide me with code properly working.
ask help, not code. put a php file with following contents on server
and see it the SMTP settings given there are correct... the server/sendmail setting is correct or not.
Okay.....
Posted: Mon Sep 11, 2006 2:47 am
by gkwhitworth
Well here is some code that is working properly:
Code: Select all
mail("email@domain.com", "Feedback Form Results" , "name: $firstName",
"From: $firstName <$email>");
header ("Location: http://www.gkwinspired.com/contact/web_feedback.php");
This works. I had tons of problems with my SMTP situation. I checked our server out and realized that we route our SMTP into our server, we actually don't have an SMTP server running. If you can find out the ip address of the SMTP server that you guys currently use you can use the following code:
Code: Select all
ini_set("SMTP","SMTP IP ADDRESS GOES HERE");
On the server there is a master php.ini file that controls the master SMTP settings, and if you control the server I would set it in there. But if you are just a user you can use this code and it will override the settings in the php.ini file.
Posted: Mon Sep 11, 2006 3:49 am
by Chris Corbyn
I don't belive the SMTP address is settable in ini_set(). Use a mailer library if you need SMTP. Swift Mailer will work.