Emailing with PHP

Okay I may be jumping ahead a little here but it’s hard to tell you about something and then not use the new found knowledge with a practical example for a few more weeks until I hit the ‘meaty’ stuff. So a quick explaination of how to email with PHP and then you can tie this together with posting form variables.

The simplest function to email is the mail() function. A quick and simple method would be

<?php mail("to_address@domain.com", "Subject Line Goes Here", "Mail Text goes here", "Headers go here but simple ones are From: me@test.com"); ?>

The headers are just the mailing headers and can be expanded on to state the type of text (plain or html), character set used etc. But for now we’ll stick to the simple “From: me@test.com”.

So that was an easy lesson!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *