I am sending out html emails. It seems to me that in order for the
images to be properly shown in the email, their src needs to be
absolute.
More precisely, /images/email/header.gif will not work, but http://localhost:3000/images/email/header.gif will. (If someone can
refute me here, I am eager to hear it). So I was looking to use the
image_tag helper to get the absolute url for the image source but I
could not figure out a solution. So what I am currently doing is this:
(setup_email is then called from the actual mailer methods)
But this is a hack and it supposes that there is a “home” controller.
Having the image_tag helper accept the :only_path parameter would be a
nice solution. I am curious to find out how others deal with this
problem since it does not seem to be so particular.
problem since it does not seem to be so particular.
Consider setting the asset host to the URL. That should turn those
image_tags()'s into full URLs. Not sure if there is a way to do that
only for email and not the entire site though.