I have a trouble with sending email message with attachment using ActionMailer.
The thing is my attachment has 'noname' filename when I reading my message in gmail.
Notifier function
class Notifier < ActionMailer::Base
def send_message
attachments["text.txt"] = {:content => "hello"}
mail(:to => "[email protected]", :subject => 'test')
end
end
Message headers:
Date: Sun, 19 Dec 2010 23:18:00 +0100 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; filename=text.txt Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=text.txt Content-ID: ...
How can I send a message with right filename?
Thanks
Make sure you have your views.
Make the correct files in app/views/[class_name]/[method_name]
Create a app/views/notifier/send_message.erb
file and app/views/notifier/send_message.html.erb
file.
Drew is right, this problem occur if specific mailer view is missing.
IMHO, gmail does not get the encoding of message and renames attachments.
More info is available in Gmail help:
http://mail.google.com/support/bin/answer.py?answer=9524
http://mail.google.com/support/bin/answer.py?hl=en&answer=10290
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