Tobias Rapp wrote:
> Hi!
> 
> I am currently using the TSmtpCli component to send email
> notifications to users. I want to change the HdrTo property value to
> additionaly contain the user name instead of just the plain email
> address. 
> 
> As my user name is retrieved from a database as WideString I wonder
> how I handle non-ASCII characters in the user name. My application is
> compiled using Delphi 2006.
> 
> I see in my mail client that such non-ASCII string parts are escaped
> like 
> 
> =?ISO-8859-1?Q?H=E4llo?= world
> 
> Is there some way to produce this string escape sequence when setting
> the HdrTo property? I have looked at the ICS sources but could not
> find the appropriate helper function.

It is much easier than you think because the component handles it for
you, take a look at the OverbyteIcsMailSnd demo.

In short: 
1) Always set property Allow8BitChars to FALSE, it defaults to TRUE.
2) Set property DefaultEncoding to smtpEnc7bit
3) In Ansi Delphi set the correct Charset property that corresponds 
to the default Windows Ansi codepage. The component assigns it 
automatically in its constructor or when you assign an empty string.
Note that assigning an invalid or non-available Charset raised an
exception and at the same time assigns the default value.
So always wrap the Charset assignment into a try except block.
Well, in Ansi Delphi UTF-8 is possible as well.
4)In Ansi Delphi set property ConvertToCharset to TRUE ONLY for UTF-8,
in Unicode Delphi this property is always TRUE and cannot be changed.
5) Always set property FoldHeaders to TRUE.

-- 
Arno Garrels


         
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to