Skip to content

ArgumentError: SMTP From address may not be blank #884

@kaka-ruto

Description

@kaka-ruto

I am getting the above exception after successfully subscribing a user to a monthly plan, in development. This is my mailer and I am clearly passing the from address

class PlanSubscriptionMailer < ApplicationMailer
  def successful_subscription
    @user = User.find_by(email: params[:user_email])

    mail(
      from: "email@email",
      to: email_address_with_name(@user.email, @user.full_name),
      subject: "HP: Successful subscription!"
    )
  end
end
 {"context":"Job raised exception","job":{"retry":true,"queue":"default","wrapped":"ActionMailer::MailDeliveryJob","args":[{"job_class":"ActionMailer::MailDeliveryJob","job_id":"8f37998d-9597-4965-bfbc-369befd320c4","provider_job_id":null,"queue_name":"default","priority":null,"arguments":["Pay::UserMailer","receipt","deliver_now",{"params":{"pay_customer":{"_aj_globalid":"gid://headportfolio/Pay::Customer/6"},"pay_charge":{"_aj_globalid":"gid://headportfolio/Pay::Charge/13"},"_aj_symbol_keys":["pay_customer","pay_charge"]},"args":[],"_aj_ruby2_keywords":["params","args"]}],"executions":0,"exception_executions":{},"locale":"en","timezone":"UTC","enqueued_at":"2023-10-26T10:11:38.662168000Z","scheduled_at":null}],"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","jid":"3d885d055a3b3113d1feb033","created_at":1698315098.662215,"enqueued_at":1698315214.7628329,"error_message":"SMTP From address may not be blank","error_class":"ArgumentError","failed_at":1698315099.602443,"retry_count":2,"retried_at":1698315162.652777}}

The stack trace point to the letter opener gem I am using on dev

/Users/kaka/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/letter_opener-1.8.1/lib/letter_opener/delivery_method.rb:32:in `validate_mail!'

Other emails are being set well and show correctly on dev via the letter opener gem.

Do pay gem emails not work well with Letter opener? (haven't tested on production yet)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions