Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

EmailDialog

edited July 2012 in General
Hi,

Is it possible to catch the subject and body text from the default email
dialog in the afteremail event.
The EmailSettings are not updated.

Version ReportBuilder: 14.05

Regards,

Christian Petter

Comments

  • edited July 2012
    Hi Christian,

    Once you call SendMail, the EmailSettings of the report are passed to
    the TppEmail object and manipulated there.

    If you would like to access the updated subject or body defined by in
    the Email dialog, access the EmailSettings property of the Report.Email
    object.

    uses
    ppEmail;

    TppEmail(ppReport1.Email).EmailSettings

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2012
    Thanks for the answer but the subject still isn't updated.

    I am using Indy with the default email dialog:

    var
    lEmail: TppEmail;
    begin
    ....
    with aReport.EmailSettings do
    begin
    Enabled := True;
    FromAddress := ..;
    UserName := ..;
    Password := ..;
    HostAddress := ..;
    PreviewInEmailClient := False;
    ShowEmailDialog := True;
    ShowCancelDialog := True;
    end;

    lEmail := TppEmail(aReport.Email);
    lEmail.SMTP.OnEmailError := eAddon.EmailErrorEvent;
    TppSMTPIndy(lEmail.SMTP).IndySMTP.Port := ..;
    TppSMTPIndy(lEmail.SMTP).IndySMTP.AuthType := satDefault


    In the preview window I am using the email button and then I send the
    email with the default dialog. Sending is ok.
    In the AfterEmail Event I want catch the subject:

    lEmail := TppEmail((Sender as TppReport).Email);
    showmessage(lEmail.EmailSettings.Subject);

    But the subject is empty.

    Regards,
    Christian
  • edited July 2012
    Hi Petter,

    Yes you are correct, the EmailSettings of the TppEmail object are
    cleared after the email has been sent from the built-in email dialog. I
    will look into making this more easily accessible for a later release of RB.

    If you are using RB 14.05 you can access the EmailMessage property of
    the TppEmail object. Try using a report event such as the BeforePrint
    to access the TppEmail.EmailMessage.Body and EmailMessage.Subject.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2012
    Unfortunately EmailMessage.Subject is also empty.

    Regards,
    Christian


    Am 26.07.2012, 19:00 Uhr, schrieb Nico Cizik (Digital Metaphors)
  • edited July 2012
    Hi Christian,

    In my testing with Indy, built-in email dialog, and the code below, the
    subject that I entered into the email dialog properly displays in the
    showmessage. Are you certain a subject is being assigned in the dialog?

    procedure TForm1.ppReport1BeforePrint(Sender: TObject);
    begin
    ShowMessage(TppEmail(ppReport1.Email).EmailMessage.Subject);

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2012
    Hi,

    I use the AfterEmail event.
    You are right, in the BeforePrint event the Subject is set.

    Regards,
    Christian

    Am 27.07.2012, 14:56 Uhr, schrieb Nico Cizik (Digital Metaphors)
This discussion has been closed.