# Rails: ArgumentError: SMTP From address may not be blank: nil / Net::SMTPAuthenticationError: 535 5.7.8 Username and Password not accepted

**Code:** `ActionMailer: SMTP From address may not be blank / Net::SMTPAuthenticationError` · **Category:** Ruby / Rails · **Seen on:** Ruby, SMTP

Rails mail delivery failed — missing `from`, wrong SMTP settings, or rejected credentials.

## Meaning

Set `default from: "noreply@example.com"` in the mailer or `ApplicationMailer`, configure `config.action_mailer.smtp_settings` (address, port 587, `enable_starttls_auto`, user, password), and use app passwords/OAuth for Gmail. `raise_delivery_errors = true` in development to see failures.

## Common causes

- No `from` address configured
- Wrong SMTP host/port/TLS
- Credentials missing (env vars not set)
- Gmail needs app password
- delivery_method not set (default :smtp to localhost)

## Quick fix

1. `default from: "noreply@example.com"` in the mailer
2. Configure `smtp_settings` and credentials via `Rails.application.credentials`
3. Test with `ActionMailer::Base.mail(...).deliver_now` in the console

## Detailed fix by platform

### Rails

1. `config.action_mailer.smtp_settings = { address: "smtp.example.com", port: 587, user_name: ENV["SMTP_USER"], password: ENV["SMTP_PASS"], authentication: :plain, enable_starttls_auto: true }`

## How to diagnose

1. **from** — Set?
2. **SMTP** — Settings correct?
3. **Auth** — App password?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rails-actionmailer-smtp-errors)
