You can go one further than that, by naming your templates like so:
signup_notification.text.plain.rhtml
signup_notification.text.html.rhtml
Then you can skip the ''part'' bit altogether.
Rails produces an email containing each part. Works like a charm.
On 27 Oct 2005, at 21:39, Forrest Thiessen wrote:
>> I need a little hint.. Is there a way with ActionMailer for sending
>> HTML and Plain Text E-Mail Simultaneously?
>>
>
> I haven''t tried this yet, myself, but docs for ActionMailer::Base
> say you can do
> it like this:
>
> # explicitly specify multipart messages
> def signup_notification(recipient)
> recipients recipient.email_address_with_name
> subject "New account information"
> from
"system-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org"
>
> part :content_type => "text/html",
> :body => render_message("signup-as-html", :account
=>
> recipient)
>
> part "text/plain" do |p|
> p.body = render_message("signup-as-plain", :account =>
> recipient)
> p.transfer_encoding = "base64"
> end
> end
>
> --Forrest
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>