Mail and Bounced Emails

Fri Sep 18 21:30:13 -0700 2009

You might have to deal with bounced emails in your application. The new mail library makes this a no brainer…

I like code more than words… so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'mail'

@mail = Mail.read('/path/to/bounce_message.eml')

# You can also do Mail.new('String of email message')

@mail.bounced?
#=> true
@mail.final_recipient
#=> rfc822;mikel@dont.exist.com
@mail.action
#=> failed
@mail.error_status
#=> 5.5.0
@mail.diagnostic_code  
#=> smtp;550 Requested action not taken: mailbox unavailable 
@mail.retryable?
#=> false

You can get mail from my GitHub repository

Once we finish a few more points in the library, I’ll release a gem.

Mikel

  1. JS Says:

    This is absolutely fantastic! Nuff said.

  2. Joel Says:

    speaking of bounced emails, does your email mikel(@)this domain work? I found a minor css problem on the code snippets not rendering properly on Windows, Google Chrome (eek) need to change line-height from 99% to 100%

  3. reboedowto Says:

    speaking of bounced emails, does your email mikel(@)this domain work? I found a minor css problem on the code snippets not rendering properly on Windows, Google Chrome (eek) need to change line-height from 99% to 100%

  4. dfh4dfh Says:

    I have the same opinion with most of your points, but some need to be discussed further, I will hold a small talk with my partners and maybe I will look for you some opinion soon.fprcghmag sg vteoqbegw hg puamowfjy te yjqxzdmwb

Leave a Reply