This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello,
i am trying to send e-mails with attachments using Mail::send(...) and Mandrill. In the October CMS documentation I couldn't find how to attach files, but I tried to do as it is in Laravel documentation: http://laravel.com/docs/5.1/mail#attachments My code:
Mail::send('mandrill.default',[], function($message) use ($receiver_emails,$send_data,$mandrill_template_name,$attached_file_paths)
{
$headers = $message->getHeaders();
foreach($send_data as $key=>$value)
{
// each X-MC-MergeVars can be up to 1000 characters
$headers->addTextHeader('X-MC-MergeVars', json_encode([$key=>$value]));
}
$headers->addTextHeader('X-MC-Template', $mandrill_template_name);
foreach($attached_file_paths as $file)
{
$message->attach("http://".$_SERVER['HTTP_HOST'].$file);
}
$message->to($receiver_emails);
});
Currently e-mail is sent without attachments. I am trying to add two files which are together around 1.5 MB. If i remove adding headers (I am setting headers as well, because i need to send Mandrill template), attachments are received as text. I tried to attach image(.jpg) and .pdf, but not in the same send - same result.
Does anyone know what might be the issue?
Last updated
1-2 of 2