Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral
  1. PatV

    GMail Inbox

    Thanks a lot for the explanation Remy ! Patrick
  2. PatV

    GMail Inbox

    Hi Remy You are right about the extra spaces, I've got another message, now. S:C1 UID STORE 193 -X-GM-LABELS (\Inbox) R:C1 BAD UID STORE not allowed now. If found also the link you mentioned How to remove a label from an email message from Gmail by using the IMAP protocol? as this one too on witch you have replied. what-belongs-in-aexpectedresponses-parameter-to-tidimap4-sendcmd I've tried also the "move" command but I didn't get the good UID, my goal was to read messages header through RetrieveHeader, and move later message selected on a TVirtualStringTree, but It seems that once I close the imap connection, those uid are no more correct. IDImap4.SelectMailBox('INBOX'); IDImap4.SearchMailBox(aSearchInfo); iUID:=0; with IDImap4 do for i:=0 to High(MailBox.SearchResult) do begin iMsg:=TIdMessage.Create; iMsg.Clear; RetrieveHeader(MailBox.SearchResult[i],iMsg); sUID:=IntToStr(MailBox.SearchResult[i]); iUID:=MailBox.SearchResult[i]; rMess.WithMessage(iMsg).WithUID(sUID).WithNode(Nil).asUnSelected; AnArray.add<rMsg>(Msgs,rMess); end; FillVST; IdIMap4.Disconnect; I'll test the function tomorrow. IdImap4.UIDStoreValue(rMess.UID, sdRemove, 'X-GM-LABELS', '\Inbox'); Thanks again Patrick
  3. PatV

    GMail Inbox

    Hi Remy, Thanks for your component and your support, I've tried it also and get an error too. IdImap4.SendCmd('UID STORE ' + rMess.UID + ' -X-GM-LABELS (\Inbox)', ['OK','BAD','NO'], true); S:C1 UID STORE 189 -X-GM-LABELS (\Inbox) R:C1 BAD Could not parse command IdImap4.UIDStoreValue(rMess.UID, sdRemove, 'X-GM-LABELS', '\Inbox'); I didn't look at this function, I'll go with it Thanks Patrick
  4. PatV

    GMail Inbox

    Hi All, I'm searching a way to remove the Tag 'Inbox' from message. I try to send command, via IdImap4.SendCmd('C1','UID STORE '+rMess.UID+' -X-GM-LABELS ("Inbox")',['OK','BAD','NO'], true); Without success. Any clues ? Regards Patrick
  5. Hi You can still use record and forget pointers TReminderItem = record FEmployeeID: Integer; FEmployeeName: String; FHireDate: TDate; FLastDate: TDate; FNotes: String; end; PReminderItem = ^TreminderItem; TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private procedure GetReminder(AList: TList<TReminderItem>); { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var LList : TList<TReminderItem>; LReminderItem : PReminderItem; begin LList := TList<TReminderItem>.Create; try GetReminder(LList); ShowMessage(Format('Name: %s', [LList[0].FEmployeeName])); finally // for LReminderItem in LList do // Dispose(LReminderItem); LList.Free; end; end; procedure TForm1.GetReminder(AList: TList<TReminderItem>); var LReminderItem : TReminderItem; begin // LReminderItem := TReminderItem.Create; LReminderItem:=default(TReminderITem); with LReminderItem do begin FEmployeeID := 1; FEmployeeName := 'Test Name'; FHireDate := Now; FLastDate := Now; FNotes := 'A Note'; end; AList.Add(LReminderItem); end;
  6. Hi Dalija, I've got your book, congrats, it is very helpful !!! Patrick
  7. Hi All, I'm using Parallel.Async to send an email, even if it's working, I would like to know if my approach is correct ; procedure TTFrmPanelPrint.SendMailParallel; var sRacine : string; sFrom,sName,sSubject,sBody : string; begin sRacine:=TPath.Combine(FReport.Directory ,FReport.FileName); sFrom := rUser(FReport.Print.Values[pspUser]^).Mail.GetMail; sName := rUser(FReport.Print.Values[pspUser]^).Name.FirstLastName; sBody :=Comment.Lines.Text; sSubject:= FFile.External; end; Parallel.Async ( Procedure(const task : IOmniTask) function AddAttach(const aRacine : string) : TStringList; var sFile : string; begin Result:=TStringList.Create; Result.Add(aRacine+cExtPdf); Result.Add(aRacine+cExtXlsx); for sFile in LBAttachments.Items do Result.Add(sFile); end; var sAttach,sTo,sBC,sCC : TSTringList; begin sAttach := AddAttach(sRacine); sTo :=TStringList.Create; sCC :=TStringList.Create; sBC :=TStringList.Create; sTo.Add(CbCommunication.Text); Task.Invoke ( procedure begin FMail.WithFrom(sFrom) .WithFromName(sName) .WithTo(sTo) .WithSubject(sSubject) .WithBody(sBody) .WithAttachments(sAttach) .WithPrcMailLog(LogAdd) .WithPrcOnDone(MailSendDone) .Send; sTo.Free; sCC.Free; sBC.Free; sAttach.Free; end ) end ); end; Thanks a lot Patrick
  8. PatV

    Sending Email via GMail Using OAuth 2.0 via Indy

    @Geoffrey Smith Thanks a lot for your sample on Github Patrick
  9. Thanks I will look at. I really don't know if I'll play with Tcp/Ip Socket or something else.
  10. I'm working with Delphi 10.3.3 Hi all, does anyone have an idea for a project like this ; On a desktop, a software (master), and on a tablet (let's says surface) the slave. I would like to send the PDF or whatever from the master to the slave on runtime. What's the best approach to communicate between the 2 ? A thread communicating with a database ? or a communication channel between the master / slave ? Thanks Patrick
  11. PatV

    TVirtualTreeView Header multilines

    found .. set coWrapCaption to True to the TVHeader.Columns[x].Options
  12. Delphi 10.3.2 TVirtualStringTree V 7.2.1 Hi All, I'm searching to add multiline to the header of a TVistualStringTree, does it exist already or do I need to use ownerdraw ? Thanks Patrick
  13. PatV

    OmniThreadPool race conditions

    ok, will check for Thanks PAtrick
  14. Hi all, Is it possible I have a race condition in a thread pool ? when I launch a task, I get a database connection from my database factory, but when the worker want to use it, Sometimes I've got an error message "mysql server has gone away", if I'm retrying after few sec, I didn't get the error message again, everything is working. Is there a specific status that a Thread from the thread pool is going to be destroyed ? Thanks Patrick FPoolSearch is definined as iOmniThreadPool; procedure TFrameCustomer.SearchForId(aValue : integer); var Params : TParameters; const cParam = 'I_IDCLI'; begin WithParamsReset(Params); WithParam(Params,cParam, aValue ,dtInteger); CreateTask(WorkerSearchId, GetTGUIDString ) .OnMessage(TaskMessage) .OnTerminated(TaskTerminated) .SetParameter('Params',TOmniValue.FromArray<rParameter>(Params)) .SetParameter('ProcName','prc_ClientSearchId') .Schedule(FPoolSearch); end; {------------------------------------------------------------------------} procedure WorkerSearchId(const task: IOmniTask); function FillData : TFCustomer; var aCust : TFCustomer; begin result:=TFCustomer.Create; with (task.ThreadData as TConnectionPoolData) do begin with DM.Proc do // Datamodule . Procedure begin WorkOnParams; // Inject parameters from the procedure Open; if RecordCount>0 then FilInfo(result,task); end; end; end; var aOVValue : TOmniValue; aRes : TFCustomer; begin (task.ThreadData as IConnectionPoolData) .WithProcedureName(task.Param['ProcName']) .WithParameters(task.Param['Params']); aRes := FillData; aOVValue := TOmniValue.CastFrom<TFCustomer>(TFCustomer.Clone(aRes)); aRes.Free; task.Comm.Send(MSG_SHOW,aOVValue); end;