Git Product home page Git Product logo

Comments (2)

bparanj avatar bparanj commented on June 23, 2024

There is an open issue: #39364. Seems like Rails currently does not support SES. See supported providers here: https://guides.rubyonrails.org/action_mailbox_basics.html. Here is the minimal test case to reproduce this problem:

# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails"
  # If you want to test against edge Rails replace the previous line with this:
  # gem "rails", github: "rails/rails", branch: "main"

  gem "sqlite3"
end

require "active_record/railtie"
require "active_storage/engine"
require "action_mailbox/engine"
require "tmpdir"

class TestApp < Rails::Application
  config.load_defaults Rails::VERSION::STRING.to_f

  config.root = __dir__
  config.hosts << "example.org"
  config.eager_load = false
  config.session_store :cookie_store, key: "cookie_store_key"
  config.secret_key_base = "secret_key_base"

  config.logger = Logger.new($stdout)
  Rails.logger  = config.logger

  config.active_storage.service = :local
  config.active_storage.service_configurations = {
    local: {
      root: Dir.tmpdir,
      service: "Disk"
    }
  }

  config.action_mailbox.ingress = :relay
end

ENV["DATABASE_URL"] = "sqlite3::memory:"

Rails.application.initialize!

require ActiveStorage::Engine.root.join("db/migrate/20170806125915_create_active_storage_tables.rb").to_s
require ActionMailbox::Engine.root.join("db/migrate/20180917164000_create_action_mailbox_tables.rb").to_s

ActiveRecord::Schema.define do
  CreateActiveStorageTables.new.change
  CreateActionMailboxTables.new.change
end

class ApplicationMailbox < ActionMailbox::Base
  routing (/^report@/i) => :dmarc_report
end

class DmarcReportMailbox < ActionMailbox::Base
  def process
    $attachments = mail.attachments
  end
end

require "minitest/autorun"

class DmarcReportMailboxTest < ActionMailbox::TestCase
   setup do
    source = <<~SOURCE
      From: [email protected] 
      To: [email protected]

      OTAzOTkueG1sUEsFBgAAAAABAAEAYAAAAFUCAAAAAA==
    SOURCE

    @inbound_email = receive_inbound_email_from_source(source)
  end

  test "the email has an attachment" do
    assert_equal $attachments.size, 1
  end
end

from rails.

HashNotAdam avatar HashNotAdam commented on June 23, 2024

@bparanj I'm using action_mailbox_amazon_ingress and I've tried the branch from that PR, neither handles this specific problem.

Given the raw email is handed off to Action Mailbox for processing, are you suggesting that SES structures emails in a way that is different from other providers? If so, do you happen to know of any examples of how this is handed by other providers? Given the SES/SNS PR has been running for 4 years, I'd be interested in helping to get this fixed, but I can't say I know much about email standards

from rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.