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);
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.
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);
Comments
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Regards,
Christian
Am 26.07.2012, 19:00 Uhr, schrieb Nico Cizik (Digital Metaphors)
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;
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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)