Adding Mandrill attachments in PHP

  • Base64 encode

    $attachment = file_get_contents(base_path() .'/reports/file.pdf');
    $attachment_encoded = base64_encode($attachment); 
  • Add to message array
$message["attachments"] = array(
        array(
            'content' => $attachment_encoded,
            'type' => "application/pdf",
            'name' => 'file.pdf',
        )
)