简体   繁体   中英

Amazon SES attachment error for ICS files

I am facing attachment error with Amazon SES service. Normal pdf or jpg files are attached properly. But when i attach a .ics file which is a calender file. I got this error.

554 Transaction failed: Illegal filename 'file_name.ics'

I am using aws-ses gem with rails 3.2.2

Is there any limitation from Amazon? And how can we request them to allow this mime type to our account?

The actual issue was that the email has content type multipart/mixed and the part which holds the ics file has the cotent type text/plain , According to Amazon MIME Types , text/plain must have extensions txt, diff, text . But in my case it was having .ics extension.

So i have to change the code from this.

attachments["file_name.ics"] = @model.to_ical

to this.

attachments["file_name.ics"] = {:mime_type => 'text/calendar',
                                            :content => @model.to_ical}

and it solved my problem.

While Amazon SES does not accept every MIME type indeed, Content Type text/calendar and Extension ics are properly supported as per their respective Appendix: MIME Types .

Without looking at their source, I suspect this to be a limitation of the aws-ses gem eventually (the list of MIME types supported by SES has grown over time) and suggest you give the official AWS SDK for Ruby (AWS Ruby Gem) a shot instead, which should nowadays provide more consistent and properly maintained development/usage experience for all already supported AWS services.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM