Hey guys,
I''m trying to format my email so that, my html email shows up correctly
when a user sees their email through gmail.com. Here is what I have so
far:
def invite(email="", sender = "")
@subject = sender.full_name + '' has invited you to
Mixbook.com''
@recipients = email
@from =
''invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org''
@sent_on = Time.now
@content_type="text/html"
@headers =
{"MIME-Version"=>1.0,"Content-Type"=>"text/html"}
@body[''sender''] = sender
end
This seems to be working when I send I see the email through outlook
express. What am I missing here. I noticed that the gmail emails that
work correctly use "multipart/alternative." Is there some kind of
trick
that I am missing?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Calle Dybedahl
2006-Nov-27 06:43 UTC
Re: setting email headers so gmail formats email correctly
> @body[''sender''] = senderI doubt that is going to work like you want it to. "Sender:" is a fairly magical header that''s used by MTAs to let MUAs know which envelope sender was used, so depending on the exact details of your mail setup that line may work as you intend, be deceptive or be overwritten. For my own application, I wrote a tiny plugin that monkeypatches ActionMailer to allow setting the sender as it should be (in the SMTP dialog for :smtp, with -f for :sendmail). I don''t have a public svn server to easily publish it from, but I could post it here, I guess. If there''s interest. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Gross
2006-Nov-27 22:47 UTC
Re: setting email headers so gmail formats email correctly
Oh the @body[''sender''] = sender shouldnt effect anything. That just insures that I have an @sender variable in my body to make the email, it doesnt go in the headers... Calle Dybedahl wrote:>> @body[''sender''] = sender > > I doubt that is going to work like you want it to. "Sender:" is a > fairly magical header that''s used by MTAs to let MUAs know which > envelope sender was used, so depending on the exact details of your > mail setup that line may work as you intend, be deceptive or be > overwritten. > > For my own application, I wrote a tiny plugin that monkeypatches > ActionMailer to allow setting the sender as it should be (in the SMTP > dialog for :smtp, with -f for :sendmail). I don''t have a public svn > server to easily publish it from, but I could post it here, I guess. > If there''s interest.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Calle Dybedahl
2006-Nov-28 15:18 UTC
Re: setting email headers so gmail formats email correctly
On 11/27/06, Eric Gross <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Oh the @body[''sender''] = sender shouldnt effect anything. That just > insures that I have an @sender variable in my body to make the email, it > doesnt go in the headers...Duh. Of course. I blame lack of caffeine. Anyway, if anyone is interested in the plugin to set the real sender, it''s on http://rubyforge.org/projects/amsenderplugin/ now. -- Calle Dybedahl -*- cdybedahl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Gross
2006-Nov-29 05:18 UTC
Re: setting email headers so gmail formats email correctly
i went to your link to check out the plugin, it says there are no files there. Can you upload them or point me to where they are? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Gross
2006-Nov-29 05:22 UTC
Re: setting email headers so gmail formats email correctly
Hmm, I think your plugin might be a little too elaborate. I just need to enable all mail programs to be able to read the text/html emails i make. I think this involves setting a multipart/alternative content type along with entering some things into the headers. Anyone here successfully created text/html with actionmailer that can be read through gmails website, it cant be that hard. =) Thanks in advance. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Fakes
2006-Nov-29 06:33 UTC
Re: setting email headers so gmail formats email correctly
Rails Recipes has a recipe for exactly this case. Here''s a snippet
that can help you along the way:
def multipart_alternative(recipient, name, sent_at = Time.now)
...
content_type "multipart/alternative"
part :content_type => "text/plain",
:body => render_message("multipart_alternative_plain", :name
=>
name)
part :content_type => "text/html",
:body => render_message("multipart_alternative", :name =>
name)
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Calle Dybedahl
2006-Nov-29 09:19 UTC
Re: setting email headers so gmail formats email correctly
On 11/29/06, Eric Gross <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > i went to your link to check out the plugin, it says there are no files > there. Can you upload them or point me to where they are?It''s all in the anonymous SVN repo for the project: svn://rubyforge.org/var/svn/amsenderplugin -- Calle Dybedahl -*- cdybedahl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Gross
2006-Dec-03 02:47 UTC
Re: setting email headers so gmail formats email correctly
Im having a lot of problems with this. With gmail, it rendering the
email incorrectly.
Here is my code:
class InviteMailer < ActionMailer::Base
def invite(email, sender)
subject sender.full_name + '' has invited you to
Mixbook.com''
recipients email
from
''invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org''
sent_on Time.now
#content_type "multipart/alternative"
headers =
{"MIME-Version"=>1.0,"Content-Type"=>"multipart/alternative"}
body ''sender'' => sender
#part :content_type=> "text/plain",
# :body =>
render_message("invite_plain",:sender=>sender)
part :content_type=> "text/html",
:body => render_message("invite", :sender=>sender)
end
end
Here is the email information it produces:
Delivered-To: aryk.grosz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Received: by 10.82.105.20 with SMTP id d20cs138436buc; Sat, 2 Dec
2006 18:13:30 -0800 (PST)
Received: by 10.65.204.7 with SMTP id g7mr9566545qbq.1165112010257;
Sat, 02 Dec 2006 18:13:30 -0800 (PST)
Return-Path: <invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org>
From: <invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org>
To: <aryk.grosz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Message-ID:
<457232c8f230_2401c7ae9814bf-RrzDkLc6n/AwhsyFmSoaXQ@public.gmane.org>
Subject: Aryk Grosz has invited you to Mixbook.com
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_000B_01C7163D.96B74DC0"
notice it comes out as multipart/mixed, why is that?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Asa Hopkins
2006-Dec-03 03:11 UTC
Re: setting email headers so gmail formats email correctly
Don''t know if this is what''s causing your problems, but GMail removes a lot of HTML formatting, which other programs leave in. It''s pretty near impossible to get an HTML email to a GMail account to come out looking like you intend. Check out http://www.campaignmonitor.com/blog/archives/2005/11/html_email_desi.html for ideas on working around mail readers'' issues. Asa Eric Gross wrote:> Im having a lot of problems with this. With gmail, it rendering the > email incorrectly. >> > Here is the email information it produces: > > Delivered-To: aryk.grosz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Received: by 10.82.105.20 with SMTP id d20cs138436buc; Sat, 2 Dec > 2006 18:13:30 -0800 (PST) > Received: by 10.65.204.7 with SMTP id g7mr9566545qbq.1165112010257; > Sat, 02 Dec 2006 18:13:30 -0800 (PST) > Return-Path: <invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org> > From: <invite-yyL2eFK7MhNBDgjK7y7TUQ@public.gmane.org> > To: <aryk.grosz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Message-ID: <457232c8f230_2401c7ae9814bf-RrzDkLc6n/AwhsyFmSoaXQ@public.gmane.org> > Subject: Aryk Grosz has invited you to Mixbook.com > MIME-Version: 1.0 > Content-Type: multipart/mixed; > boundary="----=_NextPart_000_000B_01C7163D.96B74DC0" > > notice it comes out as multipart/mixed, why is that?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Gross
2006-Dec-03 04:33 UTC
Re: setting email headers so gmail formats email correctly
thats correct, but in the above code you''ll notice the mail headers get changed, not just wants in the email. Also, facebook sends html messages that come out fine, so i know its possible. Anybody have any ideas? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Gross
2006-Dec-04 17:43 UTC
Re: setting email headers so gmail formats email correctly
I checked out that site, it doesnt seem to help with this problem. Maybe there is a setting I am missing when I initialize actionmailer? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Steven Smith
2006-Dec-04 18:10 UTC
Re: setting email headers so gmail formats email correctly
Eric Gross wrote:> I checked out that site, it doesnt seem to help with this problem. Maybe > there is a setting I am missing when I initialize actionmailer?Eric, I don''t know if this will help you but I ran into trouble with my emails as well and posted a solution to my misery here: http://www.ruby-forum.com/topic/83988#150502 I ended up base64 encoding the html portion of my emails. Perhaps it will help. Best Regards, Steven -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---