|Subject:||Problem with automatic encoding when using IdSmtp and IdMessage to send email|
|Posted by:||Henrik (forum0701…@idekonsult.se)|
|Date:||Tue, 23 Jan 2007|
I'm using D7 and Indy 10.1.5.
When sending email from our application with Indy the email is often seen as
spam at the recipient. When they are using SpamAssassin the email gets "high
score" because of two things regarding the subject encoding:
BAD_ENC_HEADER and SUBJECT_ENCODED_TWICE.
To see if it makes any difference I've been trying to substitute the
standard subject encoding code with my own simple quoted-printable function
(no line fold and encoding of the entire subject string). But I do not know
how to make my changes in the TIdMessage.GenerateHeader source code take
effect in the component.
I've also tried to pre encode the subject with something I found in a news
Subject := '=?utf-8?B?' + Base64Encode(UTF8Encode(...Subject string...)) +
If I do this everything works fine as long as the email is not sent to a
recipient using Ms Exchange. If they are the subject starts with a harmless
but irritating space character when the email arrives to them.
So all this leads to my question:
Is there something I can do about the subject encoding so that the email is
not regarded as spam when containing encoded swedish characters?
I have too little knowledge about these matters but according to my tests it
seems like the problem has something to do with that it is not the entire
subject string that is encoded but each word where the Swedish character is
You get "subject encoded twice" when the subject contains more than one with
swedish characters, and "bad encoded header" when You have several perhaps
in collaboration with line fold...?
I don't know if this hels anything but here is an example of the standard
Subject: =?ISO-8859-1?Q?=C4mnar?= prova med alla svenska tecken
=?ISO-8859-1?Q?s=E5 f=E5r?= vi se om det =?ISO-8859-1?Q?h=E4r g=E5r?= att
(remove numbers in email address if sending emails directly to me.)