Sunday, November 12, 2006

PHP Headers

Here's a cool tip i learned using php headers the other day. You can header redirect it to a mailto command. So instead of redirecting you back to a page it will open up your mail client and will bring up a compose email box. So here is an example


<?php

$email = 'foo@bar.com';
$sub = 'Hello World!';
$body = 'Hello World!';

header('Location: mailto:'.$email.'?subject='.$sub.'&body='.$body);

?>


This will open up a compose email dialog box, sending it to foo@bar.com with the subject and body containing Hello World!

No comments: