Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1206 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

ActionMailer receive function does not parse header properly when sent from Apple Mail

Reported by: Mathieu Jobin Assigned to: jamis@37signals.com
Priority: normal Milestone: 1.0
Component: ActionMailer Version: 0.12.1
Severity: normal Keywords:
Cc: somekool@gmail.com

Description

ActionMailer receive function does not parse header properly when sent from Apple Mail

a basic ActionMailer::Base.receive function...

def receive(email)
  puts email.to_yaml
end

If I send a mail from Thunderbird, I can access methods like

.from or .from_addrs

the to_yaml show is content properly.

  from: !ruby/object:TMail::AddressHeader 
    addrs: 
      - !ruby/object:TMail::Address 
        domain: 
          - firehall
        local: 
          - mathieujobin
        name: Mathieu Jobin
        routes: []
    body: "Mathieu Jobin <mathieujobin@firehall>

      "
    comments: []
    config: *id001
    illegal: false
    parsed: true

when sending mail from AppleMail, it does not parse the from information and who knows what else it is missing.

  from: !ruby/object:TMail::AddressHeader 
    addrs: []
    body: "mathieujobin@firehall <mathieujobin@firehall>

      "
    comments: []
    config: *id001
    illegal: true
    parsed: true

thank you.

Change History

04/27/05 14:29:21 changed by Mathieu

some more details...

after a few test, I realize that ActionMailer works fine with Apple Mail if the Fullname field does not contain a @ sign.

however, thunderbird's mail get parse properly whatever the fullname contain a @ sign or not.

04/27/05 15:19:45 changed by nzkoz

Could you please attach the raw source to both emails? i.e one that works and another that doesn't?

That will make it easier to trac it down.

04/27/05 15:34:36 changed by Mathieu Jobin

working one

To: matmail <matmail>
From: apache@firehall <matmail>
Subject: status of (@ sign are bad :))
Content-type: text/plain





1: --------------------------------------------------
trying to analyze bounce...
2: --------------------------------------------------
["apache@firehall"]
== no_at_sign <apache@firehall> ==
3: --------------------------------------------------

non working one

To: matmail <matmail>
From:  <matmail>
Subject: status of (worse when you use them.)
Content-type: text/plain





1: --------------------------------------------------
trying to analyze bounce...
2: --------------------------------------------------
nil
3: --------------------------------------------------

code between line 2 and 3

puts "2: --------------------------------------------------"
puts email.from.inspect
email.from_addrs.each {|x| puts "== #{x} ==" }
puts "3: --------------------------------------------------"

04/27/05 15:37:48 changed by Mathieu Jobin

those are the return mail, sorry, wrong one...

Email that worked (without @ sign)

From mjobin@combustionlabs.com Wed Apr 27 14:14:52 2005
Mime-Version: 1.0 (Apple Message framework v619.2)
To: matmail@firehall <matmail>
Message-Id: <5d7882eb3a47742f678229c4858ab4bc@firehall>
Content-Type: multipart/alternative;
	boundary=Apple-Mail-4-1037823184
From: no_at_sign <apache@firehall>
Subject: @ sign are bad :)
Date: Wed, 27 Apr 2005 14:14:52 -0700




--Apple-Mail-4-1037823184
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed


Mathieu Jobin

--Apple-Mail-4-1037823184
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
	charset=US-ASCII



<bold>Mathieu Jobin</bold>


--Apple-Mail-4-1037823184--

Email that DID NOT worked (WITH @ sign)

From mjobin@combustionlabs.com Wed Apr 27 14:15:31 2005
Mime-Version: 1.0 (Apple Message framework v619.2)
To: matmail@firehall <matmail>
Message-Id: <416eaebec6d333ec6939eaf8a7d80724@firehall>
Content-Type: multipart/alternative;
	boundary=Apple-Mail-5-1037861608
From: apache@firehall <apache@firehall>
Subject: worse when you use them.
Date: Wed, 27 Apr 2005 14:15:31 -0700




--Apple-Mail-5-1037861608
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed


Mathieu Jobin

--Apple-Mail-5-1037861608
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
	charset=US-ASCII



<bold>Mathieu Jobin</bold>


--Apple-Mail-5-1037861608--

05/08/05 13:31:06 changed by anonymous

  • milestone set to 1.0.

06/21/05 16:43:29 changed by anonymous

  • owner changed from David to jamis@37signals.com.

06/22/05 10:00:43 changed by minam

  • status changed from new to closed.
  • resolution set to fixed.

Fixed. It should be noted, though, that the fix breaks compliance with RFC 822--the @ character is special and should always be quoted. Apparently, Mail.app doesn't believe in RFC 822, though, so we'll give a best effort at interpreting what it sends.

11/16/05 20:31:57 changed by anonymous

  • cc changed from mathieu@ubertor.com to somekool@gmail.com.