06-10-2018, 01:53 AM
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:
but this is what I get:
please note that values in both 'Content-Type' and 'Content-Disposition' are folded.
And this is the code fragment I use:
If I uncomment the line where attchmnt->ContentType is set, my message arrives with
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 . I am sure there is a fix. TIA.
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
Code:
Content-Type: text/plain; charset="US-ASCII"
name="testfilename.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
filename="testfilename.txt"
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);
Code:
Content-Type: text/plain; charset="US-ASCII"; name="testfilename.txt"
name="testfilename.txt"
the file name shows as "testfilename.txt _testfilename.txt_" with 8 spaces in the middle
and 2 underscores which scares the **** out of'em . I am sure there is a fix. TIA.