08-27-2019, 06:19 PM
(08-27-2019, 02:33 PM)ccMcBride Wrote:Code:dmEmail.emMessage.ContentType := 'text/calendar;method=REQUEST';
That is the wrong ContentType value to use at the top level of the email when multiple parts are used in the TIdMessage.MessageParts collection. It MUST be set to a 'multipart/...' media type instead, in this case 'multipart/mixed' since you have an standalone attachment that is not referred to by the text parts.
(08-27-2019, 02:33 PM)ccMcBride Wrote: my mail.txt (saving the message to file) is this:
Which is completely messed up, because you are not setting up the TIdMessage correctly, not even close.
(08-27-2019, 02:33 PM)ccMcBride Wrote: ORGANIZER;CN=3DConnie M.:MAILTO:[weird that organizer name changed to start with 3D, but otherwise, same valie email address]
That is just part of how the Quoted-Printable encoding works. '=' is a reserved character in QP, so it has to be escaped in hexadecimal format (the ASCII code for the '=' character is decimal 61, hex 0x3D). 'quoted-printable' is the default encoding for TIdText parts, whereas 'base64' is the default for TIdattachment....
(08-27-2019, 02:33 PM)ccMcBride Wrote: what I am getting in return :
raised exception class EIdSMTPReplyError with message 'STOREDRV.submission.excetption : invalid recipentsException;
failed to process message due to a permanent exception with mesage. Amessage can't be sent because it contains no recipients. InvalidRecipientsException a message can't be sent because it contains no recipients.
since I DO have a recipient, I'm not sure why I am getting this message.
You did not show the code that populates the recipient(s). But the email you did show has no 'From' header in it. Maybe that is what the server is actually complaining about? Hard to say since you did not show the actual SMTP commands being sent.
(08-27-2019, 02:33 PM)ccMcBride Wrote: any ideas what I am missing?
Per https://stackoverflow.com/a/19535685/65863, try something more like this instead when populating the TIdMessage:
Code:
dmEmail.emMessage.From.Address := ...;
dmEmail.emMessage.Recipients.EMailAddresses := ...;
...
dmEmail.emMessage.ContentType := 'multipart/mixed';
with TIdText.Create(dmEMail.emMessage.MessageParts) do
begin
ContentType := 'multipart/alternative';
//ParentPart := -1;
end;
with TIdText.Create(dmEMail.emMessage.MessageParts) do
begin
ContentType := 'text/plain';
Body.Text := 'some plain text here to describe the event for email readers that don't support iCalendar';
ParentPart := 0;
end;
with TIdText.Create(dmEMail.emMessage.MessageParts) do
begin
ContentType := 'text/calendar;method=REQUEST';
Body.LoadFromFile(fName);
ParentPart := 0;
end;
with TIdAttachmentFile.Create(dmEmail.emMessage.MessageParts, fName) do
begin
ContentDisposition := 'attachment';
ContentType := 'text/calendar;method=REQUEST';
ContentID := ExtractFileName(fName);
Filename := ExtractFilename(fName);
//ParentPart := -1;
end;