|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: [PhillyOnRails] ActiveMailer issue sending email with both attachment AND body content
|
- From: Justin Reagor <justinwr@gmail.com>
- To: talk@phillyonrails.org
- Subject: Re: [PhillyOnRails] ActiveMailer issue sending email with both attachment AND body content
- Date: Fri, 20 Jun 2008 15:05:43 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:mime-version:in-reply-to :references:content-type:message-id:content-transfer-encoding:from :subject:date:to:x-mailer; bh=iXS4tdjkfbGPUj+ilt8/1WqoHd3OFAZ8IsDoFRXSyM8=; b=uwCxfPhQhhoPLrlaP4gNqd9/RUisNezQ7C4v7YyEpxUr6tNeZw+p/ciXDboeAYZvLf 7j2BEXgvCjfzneV8jyq5UxAxd+iiQUIL2v3QPtJ7byi3jphi6/rlMVr/lr8bFMX0X2eO EevS7ef65t2EiWwbugMnzHbIp9sAw8LjScAL0=
- List-archive: <http://lists.phillyonrails.org/pipermail/talk>
- Reply-to: talk@phillyonrails.org
- Sender: talk-bounces@phillyonrails.org
You happen to see this article? Didn't know there was an "attachment"
method used like this. *shrug*
http://www.travisonrails.com/2007/06/20/Adding-multiple-email-
attachments-with-Ruby-on-Rails
They are also using the "application/octet-stream" mimetype.
:: 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 rails
2.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 in
advance.
// 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
|
|