Hello,
I wonder if mandrill support ability to send mail with attached ics file.
Lets say I have some template.
function sendMailMandrillInvite($name, $contact_email, $textarea, $url, $template_name = 'invite-businesses'){
$merge = 'true';
$message = array('dest_mail' => $contact_email, 'merge' => $merge);
$message['to'] = array(array('email' => $contact_email));
$mergeVars[] = array(
'rcpt' => $contact_email,
'vars' => array(
array('name' => 'contact_name', 'content' => $name),
array('name' => 'message', 'content' => $textarea),
array('name' => 'url', 'content' => $url)
)
);
$template_content = array(array('name' => 'example name', 'content' => 'example content')); // dummy usage
$message['merge_vars'] = $mergeVars;
return $this->messages_send_template($template_name, $template_content, $message);
}
What is the way to create template (HTML) and attach ics file to make mandrill mail to be "invitation"?
Is it possible?
Thanks,
Currently, we aren't able to support the text/calendar multipart format—which is typically the format being used to add those event invitations in emails. When Mandrill's parser hits these kinds of message parts (text/calendar), it will skip over them since they don't conform to anything that it knows how to abstract away. It's not true text or HTML, attachment or embedded image. In the future, we'll look into adding special support for this particular form of message as it's quite popular, but I can't provide any specific ETA on when that might be. In the meantime, you might consider generating the .ics files and attaching them, just as you might with other types of attachments through the Mandrill API or SMTP integration.
The Mandrill Crew
So this is a way I used:
Template
{
"key": "xxxxxxxxxxxxxxxxxx",
"template_name": "fess1",
"template_content": [
{
"name": "example name",
"content": "example content"
}
],
"message": {
"merge": "true",
"to": [
{
"email": "[email protected]",
"name": "Snaggs",
"type": "to"
}
],
"headers": {
"Reply-To": "[email protected]",
"MIME-Version": 1.0
},
"merge": true,
"merge_vars": [
{
"rcpt": "[email protected]",
"vars": [
{
"name": "FNAME",
"content": "Snaggis"
}
]
}
],
"attachments": [
{
"type": "text/calendar",
"name": "meeting.ics",
"content": "QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOi0vL01lZXRlci9tZWV0ZXIvL05PTlNHTUwgdjEuMC8vRU4NCkNBTFNDQUxFOkdSRUdPUklBTg0KTUVUSE9EOlJFUVVFU1QNCkJFR0lOOlZFVkVOVA0KRFRTVEFSVDoyMDE0MTAxOFQyMDMwMDBaDQpEVEVORDoyMDE0MTAxOFQyMTAwMDBaDQpVSUQ6MjAxNDEwMTVUMDAyODEzLTIyMzc4ODg2OEBtZWV0ZXIuY29tDQpEVFNUQU1QOjIwMTQxMDE0VDIxMjgxM1oNCk9SR0FOSVpFUjtDTj0ic25hZ2dzQGdtYWlsLmNvbSI7U0VOVC1CWT0iTUFJTFRPOnNvbWVhcHBAZ21haWwuY29tIjtMQU5HVUFHRT1zZTpNQUlMVE86c25hZ2dzQGdtYWlsLmNvbQ0KQVRURU5ERUU7Q1VUWVBFPUlORElWSURVQUw7Uk9MRT1SRVEtUEFSVElDSVBBTlQ7UEFSVFNUQVQ9TkVFRFMtQUNUSU9OO1JTVlA9VFJVRTtDTj1GZXNzeSBNO1gtTlVNLUdVRVNUUz0wOk1BSUxUTzpzbmFnZ3MyQGdtYWlsLmNvbQ0KREVTQ1JJUFRJT046ZGRkZCBtYW5kcmlsbA0KTE9DQVRJT046ZGRkZGRkIG1hbmRyaWxsDQpTVU1NQVJZOkNhbiBJIGxheSBsb3c/IENvb2sgc29tZSB5YXkteW8gMg0KVFJBTlNQOk9QQVFVRQ0KU0VRVUVOQ0U6MA0KU1RBVFVTOkNPTkZJUk1FRA0KRU5EOlZFVkVOVA0KRU5EOlZDQUxFTkRBUg=="
}
]
}
}
Where content
is:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Meeter/meeter//NONSGML v1.0//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20141018T203000Z
DTEND:20141018T210000Z
UID:[email protected]
DTSTAMP:20141014T212813Z
ORGANIZER;CN="[email protected]";SENT-BY="MAILTO:[email protected]";LANGUAGE=se:MAILTO:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Fessy M;X-NUM-GUESTS=0:MAILTO:[email protected]
DESCRIPTION:dddd mandrill
LOCATION:dddddd mandrill
SUMMARY:Can I lay low? Cook some yay-yo 2
TRANSP:OPAQUE
SEQUENCE:0
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR"
content
base64_encode():
QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOi0vL01lZXRlci9tZWV0ZXIvL05PTlNHTUwgdjEuMC8vRU4NCkNBTFNDQUxFOkdSRUdPUklBTg0KTUVUSE9EOlJFUVVFU1QNCkJFR0lOOlZFVkVOVA0KRFRTVEFSVDoyMDE0MTAxOFQyMDMwMDBaDQpEVEVORDoyMDE0MTAxOFQyMTAwMDBaDQpVSUQ6MjAxNDEwMTVUMDAyODEzLTIyMzc4ODg2OEBtZWV0ZXIuY29tDQpEVFNUQU1QOjIwMTQxMDE0VDIxMjgxM1oNCk9SR0FOSVpFUjtDTj0ic25hZ2dzQGdtYWlsLmNvbSI7U0VOVC1CWT0iTUFJTFRPOnNvbWVhcHBAZ21haWwuY29tIjtMQU5HVUFHRT1zZTpNQUlMVE86c25hZ2dzQGdtYWlsLmNvbQ0KQVRURU5ERUU7Q1VUWVBFPUlORElWSURVQUw7Uk9MRT1SRVEtUEFSVElDSVBBTlQ7UEFSVFNUQVQ9TkVFRFMtQUNUSU9OO1JTVlA9VFJVRTtDTj1GZXNzeSBNO1gtTlVNLUdVRVNUUz0wOk1BSUxUTzpzbmFnZ3MyQGdtYWlsLmNvbQ0KREVTQ1JJUFRJT046ZGRkZCBtYW5kcmlsbA0KTE9DQVRJT046ZGRkZGRkIG1hbmRyaWxsDQpTVU1NQVJZOkNhbiBJIGxheSBsb3c/IENvb2sgc29tZSB5YXkteW8gMg0KVFJBTlNQOk9QQVFVRQ0KU0VRVUVOQ0U6MA0KU1RBVFVTOkNPTkZJUk1FRA0KRU5EOlZFVkVOVA0KRU5EOlZDQUxFTkRBUg==
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With