How To… Show Email Status

Question

“Is there a way to show the status of a sent email”

Solution

Use the TppSMTPCustom.OnStatusChange event to retrieve various status updates from your email server or MAPI compatible email client.  This event can be accessed from the TppReport object by typecasting the TppReport.Email object as TppEmail.

Sample Delphi code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  TppEmail(ppReport1.Email).SMTP.OnStatusChange := EmailStatusEvent;

  ppReport1.SendMail;

end;

procedure TForm1.EmailStatusEvent(Sender: TObject);
var
  lsStatus: String;
begin

  //Get the current status from the plugin
  lsStatus := TppEmail(ppReport1.Email).SMTP.Status;

  //Display the updated status
  MyStatusDialog.Status := lsStatus;

end;