Inserting custom information into email

We are trying to build a call confirmation system which places the call confirmation number into the e-mail message sent to our user. (along with the voicemail message as an attachement)

The stumbling block we’ve hit is when we try to insert a variable into either the subject line, message body or attachment name.

Anyone with ideas are welcome to comment.

Our favoured solution would be to have an e-mail sent where the subject line contains the call confirmation number.