ActionMailer Attach Original Message

I have a mailer setup to receive messages for processing data. If the
message sent is not correct then I send back an email telling the user
of their problem. I want to attach the original message and I have it
sort of working, but if the original message has an attachment that
attachment doesn’t seem to display in my Email client (Thunderbird).
Here is what I have:

def invalid_email(error, email)
recipients email.from
from email.to
subject ‘Data Import Failed!’
body :error => error
part :body => email.to_s, :content_type => ‘message/rfc822’
end

In this method “error” is some error message (a string) and email is the
TMail object that came in from the receive method.

Any ideas?

Eric

Eric,

I’m doing the same thing in one of my apps, but we opted not to use
ActionMailer in order to preserve the contents. Instead, we jut use
Net::SMTP to send it directly. Below is what I’m using using; for
clarity, I omitted exception handling code that surrounds the
Net::SMTP block:

require ‘net/smtp’

smtp_settings = ActionMailer::Base.smtp_settings

Net::SMTP.start(smtp_settings[:address], smtp_settings[:port],
smtp_settings[:domain], smtp_settings[:user_name],
smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
smtp.send_message(raw, FROM_ADDRESS, to_address)
end

-Mike Subelsky
Baltimore, MD