Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevArticles:
Making Friends with Mail()
Jan 03, 2003 @ 13:33:37

For anyone that's ever felt that joy in their hearts when they discovered PHP's mail() function, only to have it dashed because it didn't work like they'd hoped, DevArticles might just have something to help.

In their latest, Getting Intimate With PHP's Mail() Function, they start off at the beginning, holding your hand just in case you've never really used the function before. They even show you how, if the mail() function isn't enough, to talk directly to sendmail (or whatever MTA you're running) and open a pipe directly to it. Finally, they show you how to use an HTML form to get an email response, maybe from potential customers looking for product advice, or maybe just a "hey, here's an email form!" kind of form - whatever the case, the example they give is pretty flexible.

One good recommendation to note, as all web applications should look into, is: ...you still need to make sure that user input is “screened” before it is used to actually send the email. Don't get caught in the trap on simply grabbing user input and feeding it to the mail() function, because as I said, if a user knows a combination of Unix shell meta-characters then they can easily compromise the security of your web server -– and you will be liable for it. Not your web host!

tagged:

Link:


Trending Topics: