Question:
I have this in my code:
email.AddFileAttachment2(sa.GetString(j), 'UTF-8');
However, as you can see from the LastError, the file can't be attached.
ChilkatLog: AddFileAttachment: DllDate: Feb 15 2010 Username: Administrator Component: ActiveX filename: D:\MailManAttach\GetSendMailMan\Out\Attachment\æ¼¢å—ä»®å交ã˜ã‚Šæ–‡.txt contentType: UTF-8 WindowsError: The system cannot find the file specified. Failed to add file attachment
What is the best solution for this? The ChilKatMime can extract the parts without any problem. The problem appears when attaching the file again.
oopsss...the AddFileAttachment2 is working..it's the sa.GetString that is returning the garbage. so now, I'm extracting the MimeParts manually and just take note of the Filename.
Make sure you tell each object involved, such as "sa" and "email" to pass strings as utf-8 and not ANSI. See http://www.cknotes.com/?p=98
For example:
sa.put_Utf8(true); email.put_Utf8(true); email.AddFileAttachment2(sa.GetString(j), 'image/jpg');
ALSO: The 2nd arg to AddFileAttachment2 is the MIME Content-Type for the attachment, NOT the charset.
it seems the SA I'm using (Delphi Active X) doesn't have the charset property.