SMTP Mail Attachment File Remains Open

timgranttimgrant Member Posts: 15
Hi,

Just in relation to this problem:

viewtopic.php?f=23&t=48012&hilit=smtp+attachment

I still have this locking problem with version 7.3.0.1 of the component and I use the Dispose command straight after the .Send command and it sending successfully

The below links highlight the same issue, but it still locks for me. Has anyone else seen this problem persist?

NAV build 6.00.35003

To keep it in simple form, the code is like this:
....
l_autMail.AddAttachments('c:\temp\Licence ' + l_recSH."No." + '.pdf');
l_txtResult := l_autMail.Send(l_recSMTPSetup."SMTP Server", 25, FALSE, '', '', FALSE);
l_autMail.Dispose;

IF NOT ERASE('c:\temp\Licence ' + l_recSH."No." + '.pdf')THEN;
ERROR('Error on delete');
.....

https://mbs2.microsoft.com/Knowledgebas ... %242280492

MIcrosoft says to add in the new Dispose line:

PROCEDURE Send@3();
VAR
Result@1000 : Text[1024];
BEGIN
WITH SMTPMailSetup DO
Result :=
Mail.Send(
"SMTP Server",Authentication <> Authentication::Anonymous,"User ID",Password,"SMTP Server Port");,"SMTP Server Port");

Mail.Dispose; // Add this line that begians with 10 spaces.

CLEAR(Mail);

IF Result <> '' THEN
ERROR(Text003,Result);
END;

http://gotcal.com/index.php/2010/08/att ... eunit-400/

Thanks in advance,

Tim

Comments

  • timgranttimgrant Member Posts: 15
    I'm so stupid, there was a colon in the way - coincidence. Solved
Sign In or Register to comment.