Closed jfade closed 6 years ago
Thanks for the question @jfade, we will take a look and see if we have a solution for you.
Thank you! I'm hopeful we find a solution, as I much prefer SendGrid to the other services I've looked at and used. I'll keep an eye out for an update from you. Appreciate it!
Hello @jfade,
Have you given this a try using the updated library?
You can try over-riding the header like this: https://github.com/sendgrid/sendgrid-php/blob/master/test/unit/SendGridTest.php#L1075
Do you have a code snippet on how that would work in the new library?
I'm getting this error when I try it:
The attachment type cannot contain ';', or CRLF characters.
My code is:
$attachment->setType('text/calendar; charset="UTF-8"; method=REQUEST');
@chipallen2,
I have not been able to get this to work either. I've put in a ticket with the API team.
Also, I added your vote to this issue to help move it up the queue.
Thanks!
@chipallen2, @thinkingserious, sorry for not participating sooner. However, I did end up getting a workaround figured out that is not ideal, but let me proceed immediately with getting things working as I needed to. It wasn't quite what I originally wanted, but it DOES work. Maybe this will help you, @chipallen2.
It did require another library, however, so I would still like for the method in the Sendgrid PHP library to be updated. Having to use and maintain additional libraries is not something I'd like to deal with long term.
I utilized the PHPMailer library: https://github.com/PHPMailer/PHPMailer
From there, I was able to create and use SendGrid SMTP credentials to send the email like so:
$message = file_get_contents('/path/to/calendarfile.ics');
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.sendgrid.net'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'XXX'; // SMTP username
$mail->Password = 'XXX'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('fake@fake.com', 'Fake Company Meetings');
$mail->addAddress($apptWith); // Add a recipient, set earlier
$mail->isHTML(false); // Set email format as NOT HTML
$mail->Subject = $subject; //Subject variable, declared earlier
$mail->Body = $message; //Message variable, set earlier
$mail->ContentType = 'text/calendar; method=REQUEST'; //It appears that we can just set whatever here, just leave the trailing ; off as that's added by the library... I do wonder if this is technically unexpected behavior that the developers of PHPMailer wouldn't want, but it works, so I won't complain.
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
It isn't quite perfect, and it's not quite the original method I wanted that more closely mirrors what Outlook actually does in most cases. However, in some instances, Outlook will send what would've been the .ics attachment contents as the body of the email (and setting the content type of the email) instead of attaching the file and setting its content type.
Hopefully that's clear enough, and hopefully it may help... But again, it would be nice if the $attachment->setType() method would allow for the content type to be set as needed for the more detailed calendar invite message.
Thanks for sharing a workaround!
Can we please send you some swag? Just email us at dx@sendgrid.com with your mailing address and T-shirt size.
Are there any updates on this? I ran into same issue with sendgrid-python:
The attachment type cannot contain ';', or CRLF characters.
It would be great if we could use the ;
character in set_type()
or have a method allowing to append method=REQUEST
to Content-Type
.
Ah @MihailRussu, I just responded to you on another thread. currently this issue is currently on our backlog and we have added your vote to help increase the priority for a solution.
We are now running into this issue as well. The Content-Type header should either accept a charset attribute being set, or (if it's feasible), the API should be able to detect the necessary encoding type and specify it internally. (An encoding guru would probably need to chime in as to whether or not this is feasible.)
Thanks for the additional vote and feedback on this issue @winzig,
I've sent your feedback to the team.
Hello @thinkingserious ,
I guess everyone is still waiting for a solution, so am I ! I'd also like to set method to REQUEST and encounter the problem.
Do you have an update ? It's been 2 months !
Thanks, Have a nice day, Jérémy
Hi @jlanglais,
At this point, it's a matter of prioritization.
I thank you for adding your vote to the issue and I've passed it along to the team.
Hey @thinkingserious ,
I am still locked due to this problem ! Do you have any update ? Any solution ?
Thanks, Jérémy
@ataraxido,
Unfortunately, I don't have any update or solution.
I'll make another request for a status update.
@thinkingserious should I consider using another email provider since you can't solve a blocking issue within 6 months ?
@ataraxido,
Unfortunately, I still don't have an update on this one other than it is currently in the engineering backlog. If we get more people requesting this feature, that could help get this issue a higher priority.
+1 for supporting Outlook (using the PHP SDK). I've had multiple clients forced into alternative providers/clients due to this.
I've had no luck finding a workaround.
Again @thinkingserious do you plan to solve this soon ? We really need it !
@ataraxido,
At this point the only thing that can help move this item up the priority queue is more requests.
I think it would be great to have this working and I'll do what I can to continue to advocate the prioritization of this issue.
@thinkingserious
I jumped in here since it is relevant to this thread, and I'd like to request help with this as well. My attachments are now working, however, I have encounter issues with attaching .ics
files.
Definitely would be great to have this working!
:+1:
Thanks @paoga87!
I've added your vote to the issue.
I am facing the problem even for gmail also. It is sending my ical code as it is and not parsing it to convert to calendar invitation. I used V2 web API initially, than upgraded to v3 web API, than a support guy told me that i-calendar can be sent through SMPT only. I used it but not fixed my problem. I am using codeigniter framework and sending emails using its email class.
Same issue here, any update?..
@sxmichael,
This issue is currently working it's way up the backlog. I've added your vote to expedite. Thanks!
I came here from the node.js project thread: https://github.com/sendgrid/sendgrid-nodejs/issues/217.
Add my vote, too. I've got quite a bit of feature pressure here. We're on a Pro 300k level account, and if no solution is in sight I'll have to look at a different provider within the next couple of weeks.
Thank you @pascalopitz! Your vote has been added.
This is pretty high in the list, but all the feedback is welcome and appreciated. We will update as soon as we have any information to share. Please if you come across this thread and need this feature, continue to let us know. The count of people asking for a feature is very important to us.
Hey there,
Not sure if I need to comment to get to vote, but I also need this feature to send proper iCalendar event.
Thanks,
@mguillet,
Your vote is counted :)
Hi there, I am also facing same problem. when sending inline i-calendar event it simply prints the i-cal code instead of parsing it to event invitation. Sending email using simple PHP mail() function and every thing is working fine but when applied sendgrid API it doesn't works at all. Please add my vote too. Thanks.
Thanks @aammjad
Add my vote please.
Thanks.
Same here! Thanks!
@Dalrev, @robinlambert,
Your votes have been added, thanks!
Same issue here, thanks for your job @SendGridDX !
Could you add mine too? We really need this.
Please prioritize this, thank you!
Hello guys, same issue here. Do you have an ETA or a # rank to share about this on your backlog ? Thank you !
Need this too... Thanks!
+1 We need this ASAP :)
What's news on this ?
I am also waiting for solution of this bug. I think they just forgot this bug.
Looks like it for sure. Actively looking for alternatives now.
Was integrating Sendgrid, but, since this is still an issue, look like I have to look for alternatives.
Thanks to everyone adding their vote to this issue.
Your vote has been added to this item in our backlog.
Up-voting this issue to be fixed please. We really want to use SendGrid as our platform but are being forced to look at other providers instead due to this critical issue.
Thanks @Productmind, we appreciate you taking the time to add your voice.
+1 for this
Thanks @YuriyPavlishin, your vote has been counted.
I'm having an issue with needing to add custom headers for attachments to an email. I'm generating and attaching calendar appointments (meeting requests) and sending them to the users of my web application. It works perfectly for Gmail users. However, for those who are using Outlook, it does not behave as expected. After some research (and finding a related issue on the nodejs Sendgrid library) it appears that Outlook expects something additional in the header with the attachment. This is the header generated by Outlook for a meeting invite:
Content-Type: text/calendar; charset="utf-8"; method=REQUEST
and this is what I can get from SendGrid:
Content-Type: text/calendar; charset=utf-8; name="1187.ics"
It appears that, in order for me to get it to behave properly, I have to add method=REQUEST to the Content-Type header on the attachment alone. (Having the attachment name does not seem like it's going to be an issue.)
I'm currently using the v2 library. The nodejs ticket referenced above says this isn't going to be an issue with v3, but after looking at the (just published) v3 for php, I don't see the ability to change the header beyond setting the content type. Is this something that can be added or am I just missing the fact that this is doable in some other way? Thanks!