Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unfolding header lines in TIdAttachment[File]
#6
Using Indy10, I am trying to create an eMial message with attachment.
This is what I would like to see in attachment header on the receiving server side:

Code:
Content-Type: text/plain; charset="US-ASCII"; name="testfilename.txt"
Content-Disposition: attachment; filename="testfilename.txt"
Content-Transfer-Encoding: base64
but this is what I get:
Code:
Content-Type: text/plain; charset="US-ASCII"
        name="testfilename.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
        filename="testfilename.txt"
please note that values in both 'Content-Type' and 'Content-Disposition' are folded.
And this is the code fragment I use:
Code:
TIdMsg *IdMsg;
TIdSMTP *IdSMTP;
//...
TIdAttachmentFile *attchmnt = new TIdAttachmentFile( IdMsg->MessageParts, "testfilename.txt" );
//attchmnt->Headers->FoldLength = 128;
attchmnt->Headers->FoldLines = false;
attchmnt->ContentType = "text/plain; charset=\"US-ASCII\"";
//attchmnt->ContentType = "text/plain; charset=\"US-ASCII\"; name=\"testfilename.txt\"";
IdSMTP->Connect();
IdSMTP->Send(IdMsg);
If I uncomment the line where attchmnt->ContentType is set, my message arrives with
Code:
Content-Type: text/plain; charset="US-ASCII"; name="testfilename.txt"
        name="testfilename.txt"
and the GUI is almost happy: it shows the attachment properly but when users try to save it to file, 
the file name shows as "testfilename.txt        _testfilename.txt_" with 8 spaces in the middle
and 2 underscores which scares the **** out of'em  Big Grin. I am sure there is a fix. TIA.
Reply


Messages In This Thread
RE: unfolding header lines in TIdAttachment[File] - by Boba TC - 06-10-2018, 01:53 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)