Fixed base64 encoding/decoding
Tweaked template for attachments