Hi,
I'm tying to attach a .ics file to an admin notification email. I can do this fine in that when the email arrives it has the file attached. However it doesn't behave the same way that an invitation from GCal/Outlook/iCal would, i.e. letting you add the invitation/appointment to your calendar directly from the mail client.
It looks like the reason is down to the 'Content-Type' in the email. When I send one from GCal/Outlook/iCal that works fine, this is what I see in the bottom of the email source:
--[mesage id here]
Content-Type: text/calendar; charset="utf-8"; method=REQUEST
Content-Transfer-Encoding: base64
[encoded string here]
When I attach a file with this code:
add_filter("gform_admin_notification_attachments_4", "add_attachment", 10, 3);
function add_attachment($attachments, $lead, $form){
$doc = '/invite.ics';
$upload = wp_upload_dir();
$upload_path = $upload["basedir"];
$attachments = array();
$attachments[] = $upload_path . $doc;
return $attachments;
}
I get this in the email:
--[mesage id here]
Content-Type: application/octet-stream; name="invite.ics"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="invite.ics"
[encoded string here]
Any ideas how I can enforce the correct content type so the mail clients know how to handle it?
Thanks,
Ben