Jump to content
chmichael

ICS 9.3 SVN SMTP Attachment

Recommended Posts

Hello,

  I get a "attachment.asm" or (.htm if it's html) in the e-mail ICS 9.3 SVN sends.

 

Any ideas ?

 

Thank you

Share this post


Link to post

Hello,

  Here's the function which i send the e-mails

 

function SendEMail(const AArgs: TArray<String>): String;
var
  FSMTP: TSSLSmtpCli;
begin
  FSMTP := TSSLSmtpCli.Create(nil);
  FSMTP.SslContext := TSslContext.Create(nil);
  FSMTP.SslContext.SslMinVersion := sslVerTLS1_2;

  with FSMTP do
  begin
    Host := 'my.emailserver.com';
    Port := '587';
    Username := 'myuser@emailserver.com';
    Password := 'mypassword';
    AuthType := smtpAuthAutoSelect;

    ContentType := smtpHtml; // Important !!! Set it First
    //Allow8bitChars := False;
    //ConvertToCharset := True;
    CharSet := 'UTF-8';

    HdrFrom := 'myuser@emailserver.com';
    HdrTo := 'myuser@emailserver.com';
    RcptName.Text := HdrTo;
    HdrSubject := UTF8Encode(VarToStr(AArgs[0]));

    if Length(AArgs) > 1 then
      MailMessage.Text := UTF8Encode(VarToStr(AArgs[2]));

    OpenSync;
    MailSync;

    Result := ErrorMessage;

    FreeAndNil(FSMTP.SslContext);
    FreeAndNil(FSMTP);
  end;
end;

 

Using the v9.3 SVN version the e-mail which it sends adds an extra attachment which v9.1 didn't:  (either plaintext either html)

 

image.png.a1a1d9d07cad137b39f144bb349cbeb9.png

Share this post


Link to post

There have been no changes to TSSLSmtpCli since V9.0, except to build with other units. 

 

I'd make sure whatever properties are used for attachments are cleared, sorry, don't know which off hand.

 

Angus

Share this post


Link to post

I think the error is header for whatever reason it's not the correct eg:

v9.1: Content-Transfer-Encoding: quoted-printable

v9.3: Content-Transfer-Encoding: q

 

Seems 9.3 doesn't apply the correct header values

 

Also Return-Path: <> is empty (in both v9.1 and v9.3)

Edited by chmichael

Share this post


Link to post

The line:

 FEmailBody.Add('Content-Transfer-Encoding: quoted-printable')  {AG}

is unchanged in 15 years.

 

But I will test the sample to make sure it works, in a few days time.

 

Angus

 

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×