Malformed address

Giganews Newsgroups
Subject: Malformed address
Posted by:  Ciaran Costelloe (ccostell…@flogas.ie)
Date: Fri, 20 Jan 2006

In "procedure TIdEMailAddressItem.SetText(AText: string);" in
IdEmailAddress, there is the following section of code:

              // Strange use. For now raise an exception until a
real-world
              // example can be found.
              // Basically, it's formatted as follows:    {Do not
Localize}
              //    <someg…@domain.example> some-text @ some-text
              // or:
              //    some-text <someg…@domain.example> some-text @
some-text
              // where some text may be blank.
              //CC: Note you used to arrive here if the From header in
an email
              //included more than one address (which was subsequently
changed)
              //because our code did not parse the From header for
multiple
              //addresses.  That may have been the reason for this code.
              raise
EIdEmailParseError.Create(RSEMailSymbolOutsideAddress);

My application has processed literally millions of emails and only
today has this exception been hit.  The header line that caused it
(with xxx's inserted to preserve anonamimity) is:

To: "Krixxxxxx A." <A.Krxxxxx…@gxxxxxe.nl>, <Sxxxxxk…@dxxw.de>,
        <R.Bx…@gaxxxxe.nl>,
        "Korxxxxxxxxxxxer M." <M.Korxxxxxxxxxxx…@gxxxxxe.nl>,
        "Axxx Sxxxxx \(E-mail\)" <sixxxxxx…@axx.com>,
        "Ciaran Costelloe \(E-mail\) Costelloe \(E-mail\)"
<ccostell…@flogas.ie>,
        "Dexxxf Jaxxxxxxxxi \(E-mail\)" <jxxxxxxxx…@dvgw.de>,
        "Hxxxxxk J. Rxxxxxs \(E-mail\)" <r…@gxxxxc.nl>,
        "Jxxxxxs Dxxxxt \(E-mail\)" <jxxxxxs.dxxx…@axxxz.fr>,
        "Sxxxxxxxxxxg R.M." <R.M.Sxxxxxxxxx…@gxxxxxe.nl>
dxxxd.sxxxxxx…@uxxxxxxxo.com;

The last pair of addresses is at fault, they are missing the separating
",".  As a minimum, the above example should be added to the source
code, as an example as to how this unusual exception is triggered.  The
problem for me is that I don't catch this particular exception (really
because it is too difficult to unwind my code) so I am just going to
comment-out the "raise" line, which at least allows me list the emails
in that folder, albeit with the invalid address being displayed (and
any consequent "Reply" presumably failing).

Ultimately, this is another example of junk that nothing can deal with
apart from throwing an exception, but the addition of the above example
may at least give users an example of why the exception gets thrown.

Ciaran

Replies