Hi Remy,
Quote
If you really want to do that,
then you have to use "application/octet-stream" instead (which is what Indy
defaults to for uknown types).
That's perfect for me!
Quote
>By the way, when you put the text message in a text-attachment like that:
>...
>TIdText *text1 = new TIdText(IdMessage1->MessageParts, NULL);
>text1->Body->Add("Some text...");
>text1->ContentType = "text/plain";
>...
>and not in the IdMessage1->Body, it's not possible to use UUEncoding
Yes, it is. Simply set the TIdMessage::Encoding property to meUU, which in
turn sets the AttachmentEncoding property to "UUE".
>Indy gives an errormessage that only a simple textmessage plus
>attachment are allowed in UU-mode
Then you are likely using an old version.
The one delivered with my BDS2006, the info says: 9.0.50.
I have attached the code here, maybe you want to check
yourself. With my BDS/Indy I get the mentioned exception,
so I succeeded only when the part with text1 is commented.
With IdMessage1->Encoding = meMIME it's working(but text1 ignored).
------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
IdMessage1->Clear();
IdMessage1->Encoding = meUU;
TIdText *text1 = new TIdText(IdMessage1->MessageParts, NULL);
text1->Body->Add("Some text 2. ...");
text1->ContentType = "text/plain";
IdMessage1->Body->Add("Some text...");
IdMessage1->ContentType = "text/plain";
TIdAttachment *attach1 = new TIdAttachment(IdMessage1->MessageParts,
"c:\\attachment.zip");
attach1->ContentType = "application/octet-stream";
TIdAttachment *attach2 = new TIdAttachment(IdMessage1->MessageParts,
"c:\\attachment.txt");
attach2->ContentType = "application/octet-stream";
TIdAttachment *attach3 = new TIdAttachment(IdMessage1->MessageParts,
"c:\\attachment.pdf");
attach3->ContentType = "application/octet-stream";
IdMessage1->From->Name = "SENDERNAME";
IdMessage1->From->Address = "SENDERADDRESS";
IdMessage1->Subject = "Test BDS2006/Indy9.0.50 22.9.06" ;
IdMessage1->Recipients->EMailAddresses = Edit2->Text;
IdMessage1->ContentType = "multipart/mixed";
IdMessage1->SaveToFile("c:\\msg.txt",false) ;
IdSMTP1->Host = Edit7->Text;
if( CheckBox1->Checked )
{
IdSMTP1->Username = Edit4->Text;
IdSMTP1->Password = Edit5->Text;
IdSMTP1->AuthenticationType = atLogin;
}
else
IdSMTP1->AuthenticationType = atNone;
IdSMTP1->Connect(4000);
try
{
IdSMTP1->Send(IdMessage1);
}
__finally {
IdSMTP1->Disconnect();
}
IdMessage1->Clear();
}
---------------------------------------------------------
Quote
>And, in MIME mode, this text is ignored at the receiving mailserver
>(or the mailclient?)
Only if the message is malformed to begin with, or the receiver is buggy.
No, the text is not generated by Indy, take a look at the
output done with IdMessage1->SaveToFile().
There is no reference for: text1->Body->Add("Some
text 2. ..."); in the file.
This output is visible: IdMessage1->Body->Add("Some text...");
-----------------------------------------------------
From: "SENDERNAME" <SENDERADDRESS>
Subject: Test BDS2006/Indy9.0.50 22.9.06
To:
XXXX@XXXXX.COM
Content-Type: multipart/mixed; boundary="=_MoreStuf_2zzz1234sadvnqw3nerasdf"
MIME-Version: 1.0
Date: Fri, 22 Sep 2006 11:56:57 +0200
This is a multi-part message in MIME format
--=_MoreStuf_2zzz1234sadvnqw3nerasdf
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Some text...
--=_MoreStuf_2zzz1234sadvnqw3nerasdf
Content-Type: application/octet-stream;
name="attachment.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="attachment.zip"
UEsDBBQAAAAIAH1yKi7fikQuOA0AAABEAAATAAAATm90ZWJvb2tzX01pZXRlLnhsc+1cDXBcVRU+
...
AABOb3RlYm9va3NfTWlldGUueGxzUEsFBgAAAAABAAEAQQAAAGkNAAAAAA==
--=_MoreStuf_2zzz1234sadvnqw3nerasdf
Content-Type: application/octet-stream;
name="attachment.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="attachment.txt"
VEVTVE1BSUwNCg0KdGVzdG1haWwgYXR0YWNobWVudA0K5Pb8X19f319fX8TW3A0KPD48Pjw+MTIz
NDU2Nzg5MA0KRW5kZSE=
--=_MoreStuf_2zzz1234sadvnqw3nerasdf
Content-Type: application/octet-stream;
name="attachment.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="attachment.pdf"
JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29k
...)
4EBhlLw08SkooL+/J0f1WEFY4EBhlLw08SldCj4+CnN0YXJ0eHJlZgozMjAxNQolJUVPRgo=
--=_MoreStuf_2zzz1234sadvnqw3nerasdf--
.
Regards Robert