ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.73k stars 238 forks source link

Requiring images in letter_opener preview? #113

Closed ColinTheRobot closed 9 years ago

ColinTheRobot commented 9 years ago

One thing that is maybe missing from the documentation is that if your email template has images you'll need to set:

config.action_mailer.asset_host = "localhost:3000" (or whichever ENV) to allow letter_opener to build the paths correctly.

I'm having a difficult time getting all the images to load correctly, however. They are all under the same directory app/assets/images

Over half the images load, spacer.gifs for the most part. I have a background image that's required in a CSS script in . Using background-image: image-path('background.jpg')

And am receiving this error:

Failed to load resource: net::ERR_FILE_NOT_FOUND file:///Users/colin/dev/***/***/tmp/letter_opener/1440598688_3c11896/background.jpg

So that's one. I have two other images in the HTML. I'm using an image_tag to load them. There is no error. They seem as if they are required correctly but aren't rendering. If I copy the path from the source and load it in a new tab, the image works. Also, If I hard code the path localhost:3000/assets/<image.jpg> the images will render correctly.

Is this expected behavior/is there more image configuration I'm maybe missing?

nashby commented 9 years ago

So that's one. I have two other images in the HTML. I'm using an image_tag to load them. There is no error. They seem as if they are required correctly but aren't rendering. If I copy the path from the source and load it in a new tab, the image works. Also, If I hard code the path

can you try to change config.action_mailer.asset_host to *http://localhost:3000*?

Over half the images load, spacer.gifs for the most part. I have a background image that's required in a CSS script in . Using background-image: image-path('background.jpg')

have you tried using image-url?

nashby commented 9 years ago

Closing this for now. @ColinTheRobot feel free to ping me if you still have these issues. Thanks!