Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$link->ics() can't be attached on email #91

Closed
F3rrY opened this issue Jul 7, 2020 · 2 comments
Closed

$link->ics() can't be attached on email #91

F3rrY opened this issue Jul 7, 2020 · 2 comments

Comments

@F3rrY
Copy link

F3rrY commented Jul 7, 2020

Hi!

I'm doing a project with Laravel and I want to make links to create appointments to Google Calendar, Outlook, etc. So, this works perfect, but when I want to attach the link->ics() into a link or create a ics file to be attached in the mail, it doesn't work.

For example. If I make this:

var $example = $link->ics();

This generate the "data:text/calendar;charset=utf8;base64,...". So, if I put this in a a href="" attribute, when I click from outlook Windows ask me how can open this, because Windows don't know how to open.

And, if I put the $link->ics() in a file using file_put_contents($filepath, $link->ics() and then I attach to the mail like this:

Mail->send(new MailTemplate(), function($message) use ($filename) { $message->attachFromStorage($filename,'example.ics', ['mime' => 'text/calendar']); });

And I tried this:

`$file_to_attach = 'data:text/calendar;charset=utf8;base64,QkVHSU4...'

Mail->send(new MailTemplate(), function($message) use ($file_to_attach )
{
$message->attachData($file_to_attach ,'example.ics');
});`

And this:

`$file_to_attach = 'data:text/calendar;charset=utf8;base64,QkVHSU4...'

Mail->send(new MailTemplate(), function($message) use ($file_to_attach )
{
$message->attach($file_to_attach , ['as' => 'meeting.ics','mime' => 'text/calendar']);
});`

And sent the mail but in Outlook don't show me any attached file.

What could be happen?

@alies-dev
Copy link
Collaborator

alies-dev commented Jul 7, 2020

@F3rrY
i think it's connected to #71

it's a limitation of mail client, must likely we can't do anything with it.

you can try to implement a custom generator for emails using json-ld syntax https://developers.google.com/gmail/markup/reference/formats/json-ld

this topic can also help you https://stackoverflow.com/questions/57371445/schema-org-markup-in-emails

@F3rrY
Copy link
Author

F3rrY commented Jul 7, 2020

Hi! It's solved.

The error was caused by me when mounting the template view (which extends from Mailable). There I didn't indicate that I want to attach something.

So, in the class when I build the mail I put attachData specifying the information to save and the name of the file. And yes, it appears in Outlook.

Thanks and sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants