Hello code gurus,
Thanks for reading.
mail() function
Moderator: General Moderators
mail() function
Last edited by synical21 on Sat Oct 17, 2009 9:46 am, edited 2 times in total.
Re: mail() function
So did their example work for you?
Depending on your mail server you might need to make sure each line is terminated with \r\n
You also might need to split the message for SMTP to be happy
$message=chunk_split(base64_encode($message),70)
Also you might try echoing back the fields you are dumping into mail() using echo htmlentities($yourvariable) to see what is in there.
You can also try my example on your server and see how that runs (it will also show you how to protect yourself from hackers)
viewtopic.php?f=50&t=104240
Your script is also vulnerable to SQL injection where you pass raw POST values into the database. ALL of your user fields should be filtered before you do anything with them. There are several other areas where you directly use the user data in your script.
Also you might need to enable error checking to see what errors you are getting
Depending on your mail server you might need to make sure each line is terminated with \r\n
You also might need to split the message for SMTP to be happy
$message=chunk_split(base64_encode($message),70)
Also you might try echoing back the fields you are dumping into mail() using echo htmlentities($yourvariable) to see what is in there.
You can also try my example on your server and see how that runs (it will also show you how to protect yourself from hackers)
viewtopic.php?f=50&t=104240
Your script is also vulnerable to SQL injection where you pass raw POST values into the database. ALL of your user fields should be filtered before you do anything with them. There are several other areas where you directly use the user data in your script.
Also you might need to enable error checking to see what errors you are getting
Code: Select all
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);Re: mail() function
your example looks good ill try implement it now into my script, if i just change variables and fiddle with the settings it should work, it looks really user friendly well done