> ## Content Index
> Fetch the complete content index at: https://til.codes/llms.txt
> Use this file to discover other available public pages before exploring further.

# Letter opener is not processing emails in rails app
- URL: https://til.codes/letter-opener-is-not-processing-emails-in-rails-app/
- Published: 2018-12-26T17:56:57.000Z
- Updated: 2018-12-26T17:56:57.000Z
- Author: Manu Ajith
- Tags: rails, mailer, #Import 2024-07-13 21:01

`[letter_opener](https://github.com/ryanb/letter%5Fopener?ref=til.codes)` is one of the most useful gems out there for a rails developer. The configuration is pretty much easy and straightforward. But yet I stumbled upon a situation where it stopped working.

All the setup instructions were in order, but still, for some reason, the emails were not being displayed in a browser window but instead was being processed inline in the command-line or the terminal.

Google and StackOverflow were not helping, and the Github issue tracker of the gem was also not giving any pointers to this particular issue that I was facing.

## Breakthrough.!

All the while, I was trying `SomeMailer.notify.deliver`. I decided to try `.deliver!` instead of `.deliver` and to my surprise `letter_opener` thew an error.

```
ArgumentError: SMTP From address may not be blank

```

That gave me a clue that I wanted.! My rails application did not have a default `from` for the `action_mailer` config. Adding a default from address to the action mailer like the below helped solve my issue.

```
config.action_mailer.default_options  = {
  from:  "no-reply <hi@til.codes>"
}

```

While it was surprising as to why there was no error or any indication that letter\_opener was not processing the emails in the browser, it made complete sense when the bang version of the `deliver` method was used, which forced the error on you instead of failing silently and not trying to crash the app.

Hope this helps someone.!!