I cannot configure the ActionMailBox routes correctly

Hello everyone!

I have two different rails projects, one with the other, one of them already uses Action MailBox and everything works phenomenally, now I’m facing a problem that I can’t detect.

Note: The project that works fine uses actionmailbox version 7.1.3, and the project in which I am trying to replicate the same uses version 7.1.3.2, It is the only difference between one project and the other.

In both I have the following:

app/mailboxes/application_mailbox.rb

class ApplicationMailbox < ActionMailbox::Base
  routing(/@example\./i => :fordwards)
end
app/mailboxes/forwards_mailbox.rb
class ForwardsMailbox < ApplicationMailbox

  def process
    Rails.logger.info("Mail object: #{mail.inspect}")
    Rails.logger.info("From: #{mail.from.first.inspect}")
    Rails.logger.info("To: #{mail.to.inspect}")
    Rails.logger.info("Subject: #{mail.subject.inspect}")
  end

end

And with the help of the console I am testing with this code:

require 'mail'
require 'action_mailbox'

mail = Mail.new(from: 'test@example.com', to: 'your_app_mailbox@example.com', subject: 'Test Email', body: 'This is a test email')

# Create a InboundEmail
inbound_email = ActionMailbox::InboundEmail.create_and_extract_message_id!(mail.to_s)
puts "InboundEmail created!!: #{inbound_email.inspect}"

# Process InboundEmail manually
begin
  ActionMailbox::RoutingJob.new.perform(inbound_email)
  puts "Email proccesed!!"
rescue ActionMailbox::Router::RoutingError => e
  puts "Error with routing: #{e.message}"
rescue => e
  puts "Otro error: #{e.message}"
end

And this are the results:

  1. Result of the project in which everything works:
Mail object: #<Mail::Message:110120, Multipart: false, Headers: <Date: Mon, 15 Jul 2024 19:24:07 +0100>, <From: test@example.com>, <To: your_app_mailbox@example.com>, <Message-ID: <66956947574a0_2a02dac38498@MacBook-Pro-de-Diego.local.mail>>, <Subject: Test Email>, <Mime-Version: 1.0>, <Content-Type: text/plain; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>>
From: ["test@example.com"]
To: ["your_app_mailbox@example.com"]
Subject: "Test Email"
  1. Project result in which it does not work
Error performing ActionMailbox::RoutingJob (Job ID: a1324c78-5367-431d-8acf-99df4266d78e) from Async(default) in 23.12ms: NoMethodError (undefined method first' for nil):

And this error too

Enqueued ActionMailbox::IncinerationJob (Job ID: 66db5927-f030-493e-a469-b7f5627892b6) to Async(default) at 2024-08-14 18:25:06 UTC with arguments: #<GlobalID:0x00000001226706b0 @uri=#<URI::GID gid://api/ActionMailbox::InboundEmail/17>>
Error performing ActionMailbox::RoutingJob (Job ID: 6ea99a2a-7150-4678-b917-67485f09d491) from Async(default) in 45.06ms: ActionMailbox::Router::RoutingError (ActionMailbox::Router::RoutingError):

Followed by many lines of router related errors, and accompanied by this result:

Mail object: #<Mail::Message:42880, Multipart: false, Headers: <Date: Mon, 15 Jul 2024 19:25:06 +0100>, <From: test@example.com>, <To: your_app_mailbox@example.com>, <Message-ID: <6695698291dea_2c2bc1c469b7@MacBook-Pro-de-Diego.local.mail>>, <Subject: Test Email>, <Mime-Version: 1.0>, <Content-Type: text/plain; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>>
From: ["test@example.com"]
To: ["your_app_mailbox@example.com"]
Subject: "Test Email"

As you can see, in both projects I have exactly the same thing, I have followed the same steps, and I really receive the same results, but in one of them I receive the result accompanied by errors. I really have done a lot of research and I can’t find any information or solution, and I repeat that from one project to another the only difference there is is the version of actilmailbox, but is this the problem? Please I ask the community for help. Thanks in advance and sorry for my bad English.

Thanks again!