Justin Reagor on 20 Jun 2008 11:59:53 -0700 |
I'm not sure about the attachments problem, but I just use .text.html.erb and .text.plain.erb and Rails handles sending out the two multipart encodings. :: Justin Reagor :: justinwr@gmail.com On Jun 20, 2008, at 2:58 PM, Ryan Miller wrote: No dice. Andrew Libby wrote:Try setting your content_type to "multipart/alternative" Andy Ryan Miller wrote:Sure, thanks for your reply. You'll see in my model the two ways I've tried attaching the file. Both work, but both also remove my content(view). =========== controller ============== class InfoController < ApplicationController protect_from_forgery :only => [:create, :delete, :update] def index Info.deliver_test_email(params, request.env) redirect_to request.env["HTTP_REFERER"] end end =========== end controller =============== =========== model =================== class Info < ActionMailer::Base def test_email(params, request) sent_on Time.new subject 'Information request from website' recipients params[:txtEmail]from 'miller2300@comcast.net' content_type 'text/html'attachment :content_type => "image/jpeg", :body => File.read("/tmp/CGI.5798.6") body(:sent_on => sent_on,:first_name =>params[:txtFirstName], :last_name => params [:txtLastName], :address =>params[:txtEmail]) #attachment "image/jpeg" do |a| # a.filename="boris.jpg" # a.body = File.read("/tmp/CGI.5654.4") #end end end ============ end model ============== ============ view ============= <h3>Web form request at <%= @sent_on %></h3><p>From: <em><%= @first_name %> <%= @last_name %> (<%= @address % >)</em></p> =========== end view ===========-------- Forwarded Message -------- From: Andrew Libby <alibby@tangeis.com> Reply-To: talk@phillyonrails.org To: talk@phillyonrails.org Subject: Re: [PhillyOnRails] ActiveMailer issue sending email with both attachment AND body content Date: Thu, 19 Jun 2008 09:37:41 -0400 Mind posting your mailer code? This might help us figure out what's going on. Thanks. Ryan Miller wrote:I'm having some issues with a simple form mailer using ActiveMailer in rails2.0.2. I can send a plain old regular email just fine. I can send an email with an attachment just fine.But, when I try to send an email with body content AND an attachment, the email gets sent and delivered with the attachment, but the body content is completely empty. I've tried so many different things, but just can't get it to work. Anyone seen this before or suggest something to try? Many thanks inadvance. // Ryan Miller /* Vive il sogno, via come il vento! */ _______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk_______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk_______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk _______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk
|
|