advanced patterns with Rails 7.1 and ActionMailer when using custom delivery methods
I've recently upgraded my Rails application to version 7.1 and started integrating a custom delivery method for ActionMailer to send emails through a third-party service. However, I'm working with an scenario where the emails are not being sent, and I receive an behavior: `ArgumentError: wrong number of arguments (given 0, expected 1..2)` when trying to call the custom deliver method. Hereβs what my mailer class looks like: ```ruby class UserMailer < ApplicationMailer def welcome_email(user) @user = user mail(to: @user.email, subject: 'Welcome to My Awesome Site') end def custom_delivery_method(mail) # Custom logic to send email through third-party service raise ArgumentError, 'Invalid arguments' unless mail end end ``` Iβve tried invoking the custom delivery method directly in a console with the mail object, and it works fine. Here's how I'm attempting to send the email: ```ruby UserMailer.welcome_email(user).deliver_now ``` But I want to confirm if the custom delivery method is being used. I also verified that the delivery method is set in the `config/environments/development.rb` file as follows: ```ruby config.action_mailer.delivery_method = :custom config.action_mailer.custom_method = :custom_delivery_method ``` When I check the logs, I see that the `welcome_email` method is called, but it never reaches the custom delivery method. I've also confirmed that `config.action_mailer.raise_delivery_errors = true` is set, so I should be seeing any delivery errors. Are there any common pitfalls when setting up custom delivery methods for ActionMailer in Rails 7.1? What could be causing this scenario, and how can I ensure my custom delivery method is used when sending emails? For context: I'm using Ruby on Linux. This is my first time working with Ruby stable.