Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending event email
#5
(08-28-2019, 04:45 PM)rlebeau Wrote:
(08-28-2019, 02:30 PM)ccMcBride Wrote: my smtp settings (this works with all other emails)

>I see a few issues with that setup.

>- Why are you setting a password only if SSL is used?  Even if you don't use SSL to encrypt the connection, you can still login securely by using satSASL instead of ?>atDefault, and then populating the TIdSMTP.SASLMechanism with secure SASLs like CRAM-SHA1, CRAM-MD5, etc.

misnamed field name.  NOT my structure, but is the structure being used.
enable_ssl is actually 'use encryption' and
flags is actually the method of encryption (0 being none)


--updated settings:
Code:
      SMTP.Host := cdsDefaultSettings.FieldByName('SERVERNAME').AsString;
      SMTP.Username := cdsDefaultSettings.FieldByName('USERNAME').AsString;
      if cdsDefaultSettings.FieldByName('Enable_ssl').AsBoolean then
      begin
         SMTP.AuthType := satDefault;
         SMTP.Password := DecryptStr(cdsDefaultSettingsACCOUNT_ID.AsInteger);
      end
      else
         SMTP.AuthType := satNone;
      if (not IsNullStr(cdsDefaultSettings.FieldByName('PORT').AsString)) and
         (cdsDefaultSettings.FieldByName('PORT').AsInteger <> 0) then
         SMTP.Port := cdsDefaultSettings.FieldByName('PORT').AsInteger
      else
         SMTP.Port := 25;
      if cdsDefaultSettings.FieldByName('flags').AsInteger <> 0 then
      begin
         IOHandler.Host := SMTP.host;
         IOHandler.Port := SMTP.Port;
         if cdsDefaultSettings.FieldByName('flags').AsInteger = 4 then //tls
//         begin
            ioHandler.sslOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]
//            ioHandler.sslOptions.method := sslvTLSv1_2
         else
            ioHandler.sslOptions.SSLVersions := [sslvSSLv2, sslvSSLv23,sslvSSLv3];
//            ioHandler.SSLOptions.Method := TIDSSLVersion(cdsDefaultSettings.FieldByName('flags').AsInteger - 1);
         SMTP.IOHandler := ioHandler;
         if cdsDefaultSettings.FieldbyName('flags').AsInteger = 4 then
            SMTP.UseTLS := utUseExplicitTLS;
      end
      else
      begin
         SMTP.ioHandler := nil;
         SMTP.UseTLS := utNoTLSSupport;
      end;
//   end;
   emMessage.From.Address := cdsDefaultSettings.fieldByName('username').AsString;
   if not isNullStr(cdsDefaultSettings.fieldByname('display_name').AsString) then
      emMessage.From.Name := cdsDefaultSettings.FieldbyName('display_name').AsString
   else
      emMessage.From.Name := globalConnection.LoginRec.LoginName;
   if cdsuserEmail.IsEmpty then
      emMessage.ReplyTo.EMailAddresses := cdsDefaultSettings.fieldByName('username').AsString
   else
   begin
      emMessage.ReplyTo.EMailAddresses := cdsUserEmail.fieldByName('email_prime').AsString;
      emMessage.From.EMailAddress := cdsUserEmail.fieldByName('email_prime').AsString;
   end;
code for adding the ics:

Code:
procedure tdlgEMail.CreateAttachment(fName: String; IsRelated: Boolean = False; pPart: Integer = -1);
begin
   if isEvent then
   begin
      if isCancel then
      begin
         dmEmail.emMessage.ContentType := 'text/calendar; charset="utf-8";method=CANCEL';
         dmEmail.emmessage.Body.Text := eventText.Text;
      end
      else
      begin

         with tIDText.Create(dmEMail.emMessage.Messageparts) do
         begin
            ContentType := 'text/calendar;method=REQUEST';
            Body.Text := eventText.Text;
         end;
         with TIdAttachmentFile.Create(dmEmail.emMessage.MessageParts, fName) do
         begin
            ContentDisposition := 'inline';
            ContentType := 'text/calendar;method=REQUEST';
            ExtraHeaders.Values['Content-ID'] := ExtractFileName(fName);
            ContentID := ExtractFileName(fName);
            Filename := ExtractFilename(fName);
   //           parentPart := 1;
         end
      end;
   end
   else
   begin
      with TIdAttachmentFile.Create(dmEmail.emMessage.MessageParts, fName) do
      begin
         if IsRelated then
         begin
            ContentDisposition := 'inline';
            ContentType := 'image/jpeg';
            ExtraHeaders.Values['Content-ID'] := ExtractFileName(fName);
            ContentID := ExtractFileName(fName);
         end
         else
            ContentType := GetMIMETypeFromFile(fName);
         Filename := ExtractFilename(fName);
         ParentPart := pPart;
      end;
   end;

end;
mail.txt: (this one blows up when I use outlook365 as my SMTP email server)
Code:
Subject: test Event for Christophe
To: "Connie M." <conniem@provantagesoftware.com>
Content-Type: multipart/mixed; boundary="yzkm5fRQQXAs5=_A3wk7LhIPDANsDvtqFL"
MIME-Version: 1.0
Date: Wed, 28 Aug 2019 12:06:55 -0700

This is a multi-part message in MIME format

--yzkm5fRQQXAs5=_A3wk7LhIPDANsDvtqFL
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline



--yzkm5fRQQXAs5=_A3wk7LhIPDANsDvtqFL
Content-Type: text/calendar;method=REQUEST
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

BEGIN:VCALENDAR
PRODID:-www.provantagesoftware.com/v1.0/id=3D195
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER;CN=3DConnie M.:mailto:conniem@provantagesoftware.com
DTSTART:20190830T230000Z
DTEND:20190831T000000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:195
DTSTAMP:20190828T120600Z
DESCRIPTION:content type is actually set at the email level
SUMMARY:test Event for Christophe
PRIORITY:2
ATTENDEE;RSVP=3DTRUE:mailto:conniem@provantagesoftware.com
END:VEVENT
END:VCALENDAR

--yzkm5fRQQXAs5=_A3wk7LhIPDANsDvtqFL
Content-Type: text/calendar;method=REQUEST;
    name="Event195.ics"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
    filename="Event195.ics"
Content-ID: Event195.ics
Content-ID: Event195.ics

QkVHSU46VkNBTEVOREFSDQpQUk9ESUQ6LXd3dy5wcm92YW50YWdlc29mdHdhcmUuY29tL3YxLjAv
aWQ9MTk1DQpWRVJTSU9OOjIuMA0KTUVUSE9EOlJFUVVFU1QNCkJFR0lOOlZFVkVOVA0KT1JHQU5J
WkVSO0NOPUNvbm5pZSBNLjptYWlsdG86Y29ubmllbUBwcm92YW50YWdlc29mdHdhcmUuY29tDQpE
VFNUQVJUOjIwMTkwODMwVDIzMDAwMFoNCkRURU5EOjIwMTkwODMxVDAwMDAwMFoNClRSQU5TUDpP
UEFRVUUNClNFUVVFTkNFOjANClVJRDoxOTUNCkRUU1RBTVA6MjAxOTA4MjhUMTIwNjAwWg0KREVT
Q1JJUFRJT046Y29udGVudCB0eXBlIGlzIGFjdHVhbGx5IHNldCBhdCB0aGUgZW1haWwgbGV2ZWwN
ClNVTU1BUlk6dGVzdCBFdmVudCBmb3IgQ2hyaXN0b3BoZQ0KUFJJT1JJVFk6Mg0KQVRURU5ERUU7
UlNWUD1UUlVFOm1haWx0bzpjb25uaWVtQHByb3ZhbnRhZ2Vzb2Z0d2FyZS5jb20NCkVORDpWRVZF
TlQNCkVORDpWQ0FMRU5EQVINCg==

--yzkm5fRQQXAs5=_A3wk7LhIPDANsDvtqFL--

.

THIS ics file (mail.txt), however DOES work when I send through outlook:
Code:
Subject: test Event for Christophe
To: "Connie M." <conniem@provantagesoftware.com>
Content-Type: multipart/mixed; boundary="bZwjjlg5Q6=_8VO7yTNgqlJxYXfxLw4syB"
MIME-Version: 1.0
Date: Wed, 28 Aug 2019 12:12:11 -0700

This is a multi-part message in MIME format

--bZwjjlg5Q6=_8VO7yTNgqlJxYXfxLw4syB
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline



--bZwjjlg5Q6=_8VO7yTNgqlJxYXfxLw4syB
Content-Type: text/calendar;method=REQUEST
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

BEGIN:VCALENDAR
PRODID:-www.provantagesoftware.com/v1.0/id=3D195
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER;MAILTO:conniem@provantagesoftware.com
DTSTART:20190830T230000Z
DTEND:20190831T000000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:195
DTSTAMP:20190828T121200Z
DESCRIPTION:content type is actually set at the email level
SUMMARY:test Event for Christophe
PRIORITY:2
ATTENDEE;RSVP=3DTRUE:mailto:conniem@provantagesoftware.com
END:VEVENT
END:VCALENDAR

--bZwjjlg5Q6=_8VO7yTNgqlJxYXfxLw4syB
Content-Type: text/calendar;method=REQUEST;
    name="Event195.ics"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
    filename="Event195.ics"
Content-ID: Event195.ics
Content-ID: Event195.ics

QkVHSU46VkNBTEVOREFSDQpQUk9ESUQ6LXd3dy5wcm92YW50YWdlc29mdHdhcmUuY29tL3YxLjAv
aWQ9MTk1DQpWRVJTSU9OOjIuMA0KTUVUSE9EOlJFUVVFU1QNCkJFR0lOOlZFVkVOVA0KT1JHQU5J
WkVSO01BSUxUTzpjb25uaWVtQHByb3ZhbnRhZ2Vzb2Z0d2FyZS5jb20NCkRUU1RBUlQ6MjAxOTA4
MzBUMjMwMDAwWg0KRFRFTkQ6MjAxOTA4MzFUMDAwMDAwWg0KVFJBTlNQOk9QQVFVRQ0KU0VRVUVO
Q0U6MA0KVUlEOjE5NQ0KRFRTVEFNUDoyMDE5MDgyOFQxMjEyMDBaDQpERVNDUklQVElPTjpjb250
ZW50IHR5cGUgaXMgYWN0dWFsbHkgc2V0IGF0IHRoZSBlbWFpbCBsZXZlbA0KU1VNTUFSWTp0ZXN0
IEV2ZW50IGZvciBDaHJpc3RvcGhlDQpQUklPUklUWToyDQpBVFRFTkRFRTtSU1ZQPVRSVUU6bWFp
bHRvOmNvbm5pZW1AcHJvdmFudGFnZXNvZnR3YXJlLmNvbQ0KRU5EOlZFVkVOVA0KRU5EOlZDQUxF
TkRBUg0K

--bZwjjlg5Q6=_8VO7yTNgqlJxYXfxLw4syB--

.
and the only difference between the two is this line:
not working: (throws recipient error when sent through outlook smtp, but works when I use gmail smtp server)
ORGANIZER;CN=3DConnie M.:mailto:conniem@provantagesoftware.com

Works:
ORGANIZER;MAILTO:conniem@provantagesoftware.com

I have tried putting the CN part in quotes, and tried putting it in double quotes, but I still get the same error.
so, is the message still malformed?
Reply


Messages In This Thread
sending event email - by ccMcBride - 08-27-2019, 02:33 PM
RE: sending event email - by rlebeau - 08-27-2019, 06:19 PM
RE: sending event email - by ccMcBride - 08-28-2019, 02:30 PM
RE: sending event email - by rlebeau - 08-28-2019, 04:45 PM
RE: sending event email - by ccMcBride - 08-28-2019, 07:16 PM
RE: sending event email - by rlebeau - 08-28-2019, 08:19 PM
RE: sending event email - by ccMcBride - 08-29-2019, 03:12 PM
RE: sending event email - by rlebeau - 08-30-2019, 01:39 AM
RE: sending event email - by ccMcBride - 08-30-2019, 03:00 PM
RE: sending event email - by rlebeau - 08-30-2019, 05:30 PM
RE: sending event email - by ccMcBride - 09-03-2019, 05:46 PM
RE: sending event email - by rlebeau - 09-03-2019, 11:12 PM
RE: sending event email - by ccMcBride - 09-04-2019, 01:27 PM
RE: sending event email - by rlebeau - 09-04-2019, 07:46 PM
RE: sending event email - by ccMcBride - 09-05-2019, 03:07 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)