On Jul 24, 2005, at 12:37 PM, Scott Doane wrote:
> I''m completely puzzled. I''ve searched the web, the wiki
and the
> docs and cannot find a way to get a user submitted image through a
> form and have that be emailed off to someone.
>
> I can get an email to send alright, but I can''t get anything to
> attach for it. Has anyone else come across a solution for this.
>
> My code so far is this:
>
> def submit_model_search
> feedback = @params
> email = FeedbackMailer.create_model_search(feedback)
> email.set_content_type("multipart", "mixed")
> email.mime_encode_multipart(feedback[:headshot])
> email.write_back
> FeedbackMailer.deliver(email)
> end
Try this:
class FeedbackMailer < ActionMailer::Base
def model_search(feedback)
...
attachment :content_type => "image/jpeg", :body =>
feedback
[:headshot]
...
end
end
Then you just do:
def submit_model_search
FeedbackMailer.deliver_model_search(@params)
end
- Jamis