Hi,
I'm having real issues trying to get a multipart message working correctly. I want a html email with a fallback text and a text logfile attached.
The Pony code I'm trying to use is as follows:
Pony.mail({
:to => EmailSettings::EmailTo,
:from => 'nor...@somewhere.com',
:subject => 'This is the subject',
:html_body => get_email_body(result_data, 'EmailTemplates/HtmlEmailTemplate.erb'),
:body => get_email_body(result_data, 'EmailTemplates/TextEmailTemplate.erb'),
:attachments => {log_file => File.read("logs/#{log_file}")},
:charset => 'UTF-8',
:text_part_charset => 'UTF-8',
:via => :smtp,
:via_options => {
:address => EmailSettings::SmtpServer,
:port => EmailSettings::Port,
:enable_starttls_auto => true,
:user_name => EmailSettings::Username,
:password => EmailSettings::Password,
:authentication => EmailSettings::Authentication, # :plain, :login, :cram_md5, no auth by default
:domain => 'localhost.localdomain' # the HELO domain provided by the client to the server
}
})
However this just shows the text body in outlook rather than the html body. If I remove the attachment the html body shows fine. If I remove the body text the html shows raw in the email window and attaches both the text logfile and the html.
Can anyone see what I'm doing wrong?
Thanks