

Ian Branch
Members-
Content Count
1431 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Ian Branch
-
Hi Remy, Ahhhh, Tks. As simple as that. I was half expecting it to be more complex. :-) I have added that code.. IdSMTP1.AuthType := satDefault; IdSMTP1.UseTLS := utUseExplicitTLS; // IdSMTP1.OnWork := IdSMTP1Work; IdSMTP1.OnWorkBegin := IdSMTP1WorkBegin; IdSMTP1.OnWorkEnd := IdSMTP1WorkEnd; // Now when run I get the error message.. "Connection closed Gracefully", and nothing sent. :-( If I comment out this line.. try IdSMTP1.Connect(); //IdMessage1.SaveToStream(TmpStream, False); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< IdSMTP1.Send(IdMessage1); ShowMessage('Email sent'); and run it, I get an access violation error when achieving 6%. :-( Probably not surprising. This is probably the difference between the original procedure/event definitions, were apparently incompatible, I don't know.. Old... New.. type TForm1 = class(TForm) btnSend: TButton; Button2: TButton; Button3: TButton; ProgressBar1: TProgressBar; Label1: TLabel; procedure btnSendClick(Sender: TObject); procedure Button2Click(Sender: TObject); procedure IdSMTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64); procedure IdSMTP1Work(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64); procedure IdSMTP1WorkEnd(ASender: TObject; AWorkMode: TWorkMode); The original procedures, shown in my previous email, are a little old, do they need 'revision'? I haven't mentioned - D10.4.1 & Indy 10 as distributed with it. Regards & TIA, Ian
-
Hi Thomas, Errors when building #3451 D2007 & D10.4.1. Regards, Ian
-
Hi Team, For reference/interest, this is what I am trying to get to work.. procedure TForm1.btnSendClick(Sender: TObject); var Attachmentfile: TIdAttachmentFile; sSendReportTo, sSendReportCC: string; begin // IdSMTP1 := TIdSMTP.Create(nil); // try // IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(IdSMTP1); IdMessage1 := TIdMessage.Create(IdSMTP1); // // IO HANDLER SETTINGS // with IdSSLIOHandlerSocketOpenSSL1 do begin MaxLineAction := maException; SSLOptions.Method := sslvTLSv1; SSLOptions.Mode := sslmUnassigned; SSLOptions.VerifyMode := []; SSLOptions.VerifyDepth := 0; end; // // SETTING SMTP COMPONENT DATA // IdSMTP1.Host := 'smtp-mail.outlook.com'; IdSMTP1.Port := 587; IdSMTP1.Username := 'xxxxxx@someplace.com'; // please change to your gmail address // IdSMTP1.Password := 'MyPWD'; IdSMTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1; IdSMTP1.AuthType := satDefault; IdSMTP1.UseTLS := utUseExplicitTLS; // // SETTING email MESSAGE DATA // IdMessage1.Clear; // sSendReportTo := 'yyyyyy@someplace.com'; // Temporary while testing this functionality. sSendReportCC := 'zzzzzz@someplace.com;aaaaaa@someplace.com;bbbbbbb@someplace.com'; // Temporary while testing this functionality. // Process TO: Addressees. while StrTokenCount(sSendReportTo, ';') > 0 do begin // with IdMessage1.Recipients.Add do begin Name := ''; Address := StrToken(sSendReportTo, ';'); end; // end; // Process CC: Addressees. while StrTokenCount(sSendReportCC, ';') > 0 do begin // with IdMessage1.CCList.Add do begin Name := ''; Address := StrToken(sSendReportCC, ';'); end; // end; // add Attachment to mail // Attachmentfile := TIdAttachmentFile.Create(IdMessage1.MessageParts, 'E:\IndySMTPEmailTest\ReadMe.txt'); // IdMessage1.From.Address := 'xxxxxx@someplace.com'; // please change to your gmail address //; IdMessage1.Subject := 'Test Email Subject'; IdMessage1.Body.Text := 'Test Email Body'; IdMessage1.Priority := mpHigh; // with TIdText.Create(IdMessage1.MessageParts, nil) do begin Body.Text := '<p style="color: #5e9ca0;">This is a test <strong>message</strong> for <span style="color: #ff0000;"><strong>emailing</strong></span>.</p><h1 style="color: #5e9ca0;"> </h1>'; ContentType := 'text/html'; end; // IdMessage1.ContentType := 'multipart/mixed'; // try IdSMTP1.Connect(); IdMessage1.SaveToStream(TmpStream, False); // TmpStream declared as a form variable. TmpStream: TStream; IdSMTP1.Send(IdMessage1); ShowMessage('Email sent'); IdSMTP1.Disconnect(); except on e: Exception do begin ShowMessage('Error message is - ' + e.Message); IdSMTP1.Disconnect(); end; end; // Attachmentfile.Free; // finally IdSMTP1.Free; end // end; procedure TForm1.IdSMTP1Work(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64); var nPer: Currency; begin // nPer := 0.0; // try nPer := (AWorkCount / ProgressBar1.Max) * 100; except end; // ProgressBar1.Position := AWorkCount; Label1.Caption := CurrToStrF(nPer, ffFixed, 0) + ' %'; Form1.Update; end; procedure TForm1.IdSMTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64); begin Label1.Caption := '0 %'; ProgressBar1.Position := 0; ProgressBar1.Max := TmpStream.Size; Form1.Update; end; procedure TForm1.IdSMTP1WorkEnd(ASender: TObject; AWorkMode: TWorkMode); begin ProgressBar1.Position := ProgressBar1.Max; Label1.Caption := '100 %'; Form1.Update; end; Regards, Ian
-
Hi Team, Is it safe/better to do this.. .... .... // IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(Self); IdSMTP1 := TIdSMTP.Create(Self); IdMessage1 := TIdMessage.Create(Self); // .... .... ..... // IdSSLIOHandlerSocketOpenSSL1.Free; IdSMTP1.Free; IdMessage1.Free; // ... end; Or this.... .... .... // IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(nil); IdSMTP1 := TIdSMTP.Create(nil); IdMessage1 := TIdMessage.Create(nil); // .... .... ..... // FreeAndNil(IdSSLIOHandlerSocketOpenSSL1); FreeAndNil(IdSMTP1); FreeAndNil(IdMessage1); // ... end; Or something else? Or doesn't it matter? Regards & TIA, Ian
-
Hi Remy, Now hat's an interesting construct. IIUC, by using IdSMTP1 like that, when IdSMTP1 is Free'd it automatically frees IdSSLIOHandlerSocketOpenSSL1 & IdMessage1. Sneaky. Ian
-
Hi Team, For years, up to and including D10.4.1, I have been using the following in my App, and it has been running without issue via RDP on a Customer's Win 2012 R2 Server.. {Main Form code} procedure TMainForm.mnuRemovePartsClick(Sender: TObject); begin // TRemovePartsForm.Create(Self).ShowModal; // end; {code} and in RemovePartsForm I have this at Close.. {RemovePartsForm code} procedure TRemovePartsForm.FormClose(Sender: TObject; var Action: TCloseAction); begin dmS.DBC1.CloseDataSets; Action := caFree; end; {code} Closing RemovePartsForm takes me back to the Main Form. Rebuilding the App in D10.4.2, and running it on the Server, when the Close button is clicked and the form closes the App crashes to the OS effectively at the Action := caFree! 😞 It does not happen on my Dev Win 10 PC. I have a work around.. {Main Form code} procedure TMainForm.mnuRemovePartsClick(Sender: TObject); var RemovePartsForm: TRemovePartsForm; begin // RemovePartsForm := TRemovePartsForm.Create(Self); // try // RemovePartsForm.ShowModal; // finally RemovePartsForm.Free; end; // end; {code} and .... {RemovePartsForm code} procedure TRemovePartsForm.FormClose(Sender: TObject; var Action: TCloseAction); begin dmS.DBC1.CloseDataSets; end; {code} And it all works as it used to. Unless someone can enlighten me otherwise, I suspect an issue here.. Regards, Ian
-
Dalija - Noted. I have just finished doing just that. FrOsT.Brutal - Noted.
-
Ahh. Excellent. Thank you for the clarification.
-
Ahhhh Ha! Tks Francois. I have eliminated the caFree in the OnClose event. Regards, Ian
-
Yes, I started with the components on the form but removed them in favour of creating on the fly and just got into the '1' habit. 🙂 Having said that, I take your point. I feel a global search and replace coming on. 🙂 I guess the main thrust of the question in my mind is should I use '.Free' or 'FreeAndNil(' or doesn't it matter, with .Create(nil)?? Ian
-
Hi emailx45, The Login form is generic across 18 Apps. In this piece of code.. if TLogInForm.Execute('DBiUsers', BinToInt('1')) then begin // I am passing parameters to the Login form that will indicate the App Name and the permission(s) the User needs for the respective App based on their role in the organisation. Regards, Ian
-
Hi Emailx45, Message received. :-) So here's a scenario.. In the project file I have the following.... ... ... begin // Application.Initialize; // UseLatestCommonDialogs := True; // // 7 6 5 4 3 2 1 0 // 1 // Bits 0 -> 1 = 1 if TLogInForm.Execute('DBiUsers', BinToInt('1')) then begin // Application.Title := 'DBiUsers Utility for DBWorkflow'; Application.MainFormOnTaskbar := True; Application.CreateForm(TMainForm, MainForm); Application.Run; // end; end. In the Loginform OnClose event I have the following... .... ..... public { Public declarations } class function Execute(const sApplication: string; const iBits: SmallInt): Boolean; end; .... .... implementation uses UsersData; {$R *.dfm} class function TLogInForm.Execute(const sApplication: string; const iBits: SmallInt): Boolean; begin // sApp := sApplication; iBitsSet := iBits; // with TLogInForm.Create(nil) do try Result := ShowModal = mrOk; finally Free; end; // end; .... .... ... procedure TLogInForm.FormClose(Sender: TObject; var Action: TCloseAction); begin // DBC1.CloseDataSets; // DBC1.Close; DBSLogin.Close; DBE1.Close; // Action := caFree; // end; Based on your description, Free; in the Execute procedure should be FreeAndNil? And the Action := caFree; in the OnClose removed. I'm guessing yes to both. Regards, Ian
-
Yes. I put a message in before and after the Action line. Got both but it never back to the main form where I had another message.
-
All, Found it! It was caused by the Beta version of LMDs 2021 Tools. Eugene is now aware of it and has pointed to the 'switch' to turn it off, it will be taken care of in the release version of LMD Tools 2021. Thanks to all for your input, Ian
-
Hi Francois, The Server is a Win 2012 R2. My apologies, incomplete information. They have checked via RDP, on the Server PC itself, and on their Win7 & Win 10 workstations with the same result. Very frustrating. But, as I said, I can't make it happen here on my Win 10 Dev PC. I am giving up on it att until the update for 10.4.2 arrives and I will retry it then. I have spent two full days on it now and the Customer is rightly teed off. Restoring to 10.4.1 has placated him att. Ian
-
I have reverted back to 10.4.1, with the code reverted to pre 10.4.2. Same IDE Plug-ins, same libraries. All testing so far has not produced any crashes. Testing continues.
-
Hi Francois, It doesn't fail on my PC. Only when run via RDP at the Client's site on their Server. Just to totally verify, I am going back to 10.4.1 to test further. Ian
-
Good Question. I honestly don't recall. The first time I noticed it was when I started working on my Apps which was after I had loaded my usual Experts & libraries. So. I just de-installed all my Experts, issue persisted. I am now de-installing my libraries to see if any of them are the culprit. We shall see...
-
In my case it doesn't matter what the component, button, form, panel or grid, native or 3rd Party, they all do/show the issue for Boolean properties.
-
Hi Team, 1. This issue is happening all the time in D10.4.2. 2. This did not happen to me in D10.4.1 3. I changed my scaling to 100%, same issue. 4. I changed my resolution from the my normal 3840 x 2160 to 1920 x 1080 @ 100%, same issue. Ian
-
Hi Team, D10.4.2. Can somebody point me to a breakdown of the various setting for the DPI Awareness in the Delphi Manifest please? Settings for D10.4.1 should be OK/applicable. Regards & TIA,
-
Hi Francois, It is always like that unless I click on the Property, then it shows correctly. Ian
-
10.4.2 installer deletes all GetIt packages, but does NOT RE-INSTALL!
Ian Branch replied to David Schwartz's topic in General Help
ROFLMAO -
10.4.2 installer deletes all GetIt packages, but does NOT RE-INSTALL!
Ian Branch replied to David Schwartz's topic in General Help
Hi David, Did you use the ISO or Web install? If the Web, did you simply run the 10.4.2 install with 10.4.1 still installed or did you de-install 10.4.1 first. Reason for the questions...I have become a little confused as to what exactly needs to be done with what. -
Was that the Migration tool from 10.4.1??