Rails 删除标题中包含某些文字的 email

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require 'net/pop'

mail_server = Net::POP3.new('mail.mailservernamehere.com')


mail_server.mails.each do |m|
  m.delete if m.header =~ /Subject:.+?medicines\b/i
end