简体   繁体   中英

Testing Action Mailbox controller using raw email source

I'm having a problem where email attachments aren't coming through for certain emails, but are for others. I'm trying to figure out what's different about the emails that aren't working.

Is it possible to write a test for an Action Mailbox controller where the Mail object I'm using gets generated from a raw email body, so that I can recreate the email conditions as close to reality as possible?

The answer is to use from_source :

source = File.read("some_email_source.txt")
process(Mail.from_source(source))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM