They say you learn something new every day.

Posts tagged ‘email’

Sending eMail (01/05/2012)

As much as I may hate it, sometimes you have to send eMail with code. Like democracy, eMail is the worst form of communication, except for all the others.

Each coding language has different ways of sending eMail. I had to send some messages with PHP today, so I put this little function together:

function send_email($from, $to, $subject, $message)
$headers = “From: “.$from.”\r\n”;
$headers .= “Reply-To: “.$from.”\r\n”;
$headers .= “Return-Path: “.$from.”\r\n”;
$headers .= “Content-type: text/html\r\n”;

It turns out you can’t use bcc in PHP (it’s blocked for security reasons, bizarrely). So when I wanted to bcc someone, I just had to call the same function twice with different email addresses.

Tag Cloud