Menu

#56 Umlaut in subject causes a corrupt mail

open
None
5
2005-03-11
2005-02-21
Anonymous
No

Hi Ian

Since version 1.10, the mail gets corrupted when the
subject contains a umlaut(ä,ö,ü).

This is the header from a corrupted mail, the original
subject is: 'DataFormErrorState - Buttons für Farben
sind keine DnxWinControls'

Microsoft Mail Internet Headers Version 2.0
Received: from WS32SG ([192.168.1.117]) by mail.all-
consulting.ch with Microsoft SMTPSVC(6.0.3790.211);
Mon, 21 Feb 2005 12:58:21 +0100
Reply-To: "HelpDeskSoftware" <HelpDeskSoftware@all-
consulting.ch>
From: "HelpDeskSoftware" <HelpDeskSoftware@all-
consulting.ch>
To: "=?ISO-8859-1?Q?Z=FCger Thomas?=" <zueger@all-
consulting.ch>
CC: "Brunner Alex" <brunner@all-consulting.ch>
Subject: =?ISO-8859-1?Q?1399 - Aktualisiert: HelpDesk
1.2.2.0 - DataFormErrorState - Buttons f=
Return-Path: HelpDeskSoftware@all-consulting.ch
Message-ID:
<ACCOMM1ZcdwY6RYIWUS0000015d@mail.all-
consulting.ch>
X-OriginalArrivalTime: 21 Feb 2005 11:58:21.0082 (UTC)
FILETIME=[A372EFA0:01C5180C]
Date: 21 Feb 2005 12:58:21 +0100

Regards,
Thomas

Discussion

  • Nobody/Anonymous

    Logged In: NO

    It seams to me that this only happens when the subject is
    longer than 76 characters -> MailEncoder.cs line 230 ff?

     
  • Ian Stallings

    Ian Stallings - 2005-03-11

    Logged In: YES
    user_id=83842

    Thanks Thomas, this is probably due to the encoder changes,
    I'll have to dig further into it and take a look

     
  • Ian Stallings

    Ian Stallings - 2005-03-11
    • assigned_to: nobody --> sheda0
     
  • GWSyZyGy

    GWSyZyGy - 2005-04-07

    Logged In: YES
    user_id=1068867

    Don't know if this will fix your problem, but apparently I never
    sent in this fix. With these changes, I could send accented
    subject lines up to 255 chars (I think Outlook is chopping it).
    Actually, I was sending UNICODE which I know Outlook
    doesn't handle in the subject so it gets "reduced" to ASCII.
    OpenSMTP will only preserve unicode in the BODY if you
    switch from ISO-8859-1 to UTF-8.

    internal static string
    ConvertHeaderToQP(string s, string charset, bool
    forceconversion)
    {
    if (!forceconversion)
    {
    bool
    needsconversion=false;
    for (int i=0;
    i<s.Length; i++)
    {
    if (s[i]
    > 126 || s[i] < 32 || s[i] == '=' || s[i] == '?')
    {

    needsconversion=true;

    break;
    }
    }
    if (!
    needsconversion)
    {
    return
    s;
    }
    }
    // TURNER.BSD MODIFIED
    9/29/2004 GKW to fix encoding problems in outlook.
    // appears from other
    mailers that EACH line of QP must be wrapped
    // also, spaces are replaced
    with _
    string[] lines = ConvertToQP
    (s, charset).Replace("\r\n", "\n").Split(new Char [] {'\n'});
    s = string.Empty;
    for(int i=0; i<lines.Length;
    i++)
    {
    // remove any
    trailing '=' (line continuation tag)
    if (lines
    [i].EndsWith("=")) lines[i] = lines[i].TrimEnd('=');
    s += "=?" +
    charset + "?Q?" + lines[i].Replace(' ', '_') + "?=";
    if (i<lines.Length)
    s += "\r\n ";
    }
    return s;
    }

    /* Test subject line (in Turkish, I think. If &#351;=s, it's been
    reduced):

    Ramilin resimleri 3 ki&#351;isel, 5 genel olmakla toplam 8 sergide
    gsterilmi&#351;tir. Ressam&#305;n resimleri ilk olarak Nahcivan zerk
    Cumhuriyeti Genlik, Spor ve Turizm Bakanl&#305;&#287;&#305;n&#305;n Nevruz
    bayram&#305; trenleri erevesinde yapt&#305;&#287;&#305; "Yurdumuza Nevruz
    gelir" &#351;iarl&#305; musabakada sergilenmi&#351; ve birinci olmu&#351;tur. Bu
    musabakaya Ramil 9 resmi ile kat&#305;lm&#305;&#351;t&#305;r. Ayn&#305; y&#305;l Nahcivanda
    yerle&#351;en Ticaret Merkezinde ressam&#305;n ilk ki&#351;isel sergisi
    a&#305;lm&#305;&#351;t&#305;r. Bu sergide gen ressam&#305;n 60 resmi sergilenmi&#351; ve
    ziyaretilerin ilgisini ekmi&#351;tir. Ressam&#305;n ikinci ki&#351;isel sergisi
    2001 y&#305;l&#305;nda Nisan ay&#305;nda &#350;erur Trk Lisesinde Bilim Sergisi
    erevesinde a&#305;lm&#305;&#351;t&#305;r.

    Actually showed up in Outlook (only 255 chars)
    Ramilin resimleri 3 kisisel, 5 genel olmakla toplam 8 sergide
    gsterilmistir. Ressamin resimleri ilk olarak Nahcivan zerk
    Cumhuriyeti Genlik, Spor ve Turizm Bakanliginin Nevruz
    bayrami trenleri erevesinde yaptigi "Yurdumuza Nevruz
    gelir" siarli musab

    */

     
  • Thomas Zueger

    Thomas Zueger - 2005-05-18

    Logged In: YES
    user_id=1148645

    Thanks a lot for your code, it solves the problem!

    Regards,
    Thomas

     

Log in to post a comment.