How do you visualize e-mail views in development mode #2

Closed
guiocavalcanti opened this Issue Oct 7, 2011 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

guiocavalcanti commented Oct 7, 2011

I'm using this Gem and it's working very well. But I can't realize how to visualize the delivered e-mail with images.

I tried sending to my GMail account but I can't see the images (the generated HTML image path is just /images/mail/my-img.png). There is any config to add the http://0.0.0.0:3000 part to the image path?

Owner

ndbroadbent commented Oct 7, 2011

Hi, I'm glad the gem is working well for you!

I've had the image URL issue too. You just need to explicitly define the URL when you create your image_tag, like this:

image_tag(URI.join(root_url,"stylesheets/images/logo.png").to_s)
Contributor

guiocavalcanti commented Oct 7, 2011

Humm, I see. But I have about 7 image_tag on my e-mail view.

How about creating a configuration to append the URL to all paths. I saw that premailer has such feature. Any thoughts on that?

Owner

ndbroadbent commented Oct 7, 2011

Ah, I agree, that sounds like a great idea. The relevant place to change this is when we call Premailer.new() here: https://github.com/ndbroadbent/actionmailer_inline_css/blob/master/lib/action_mailer/inline_css_hook.rb#L8

We just need to pass something like :base_url => ActionMailer::Base.default_url_options[:host].
Would you be able to try that and test it? I'm about to go out tonight, but could otherwise have a look at this tomorrow morning.

Contributor

guiocavalcanti commented Oct 7, 2011

Ok, I could do that. :)

Just a matter of curiosity: which convention didn't you agree with from premailer-rails3 gem?

Owner

ndbroadbent commented Oct 7, 2011

The way it handles CSS didn't seem right. I also like to write my text parts for emails manually, and I needed to support UTF-8. The two gems are so tiny though, I guess there's probably no reason why we can't work together ...

ndbroadbent added a commit that referenced this issue Oct 10, 2011

Merge pull request #3 from guiocavalcanti/base-url
Using ActionMailer default host as Premailer base_url. Issue #2.
Contributor

guiocavalcanti commented Oct 10, 2011

Thanks for accepting the pull request. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment