Home General

Send report via mail using standard mail client

edited May 2011 in General
Hi,

I need to send a report via Email using the configured standard email
client.

So I've looked at the Developers Guide, and it says it should work this way:

ppReport1.EmailSettings.Enabled := True;
ppReport1.Print;

But it doesn't seem to work as expected:

1. I click on the print button in my app, the form "ReportBuilder Email"
is shown.
2. I type in an Email-Adress, a subject an some text
3. I press send.
4. After a few seconds the form "ReportBuilder Email" is opened again -
the fields email, subject, and message are empty again
5. I type Email, subject and message second time and press send
6. This time nothing happens.

So I've implemented the "show email error" funcitonality
(http://www.digital-metaphors.com:8080/Output/Email/How_To...Show_Email_Errors),
but there are no errors displayed.

What could be wrong?
Thank you very much,
kind regards,
ben

Comments

  • edited May 2011
    Sorry, I've posted the wrong code.
    I tried it this way:

    TppEmail(ppReport1.Email).SMTP.OnEmailError := EmailErrorEvent;
    ppReport1.EmailSettings.PreviewInEmailClient := True;
    ppReport1.SendMail;

    Am 03.05.2011 17:37, schrieb B.Wolf:
  • edited May 2011
    Hi Ben,

    I need more information about how your application is designed and what
    exactly you would like to happen. You appear to have changed some of
    the other EmailSettings properties as well.

    1. Simply setting the EmailSettings.Enabled property to True enables the
    Email button on the Report Preview window. This does not automatically
    email a report once Print is called. If you want to automatically email
    a report, you need to call Report.SendMail.

    2. It appears you are trying to use the built-in email dialog. This is
    only to be used when using a direct send email plugin such as Indy or
    Synapse. If you want to use the email client on the machine you are
    using, you will want to set the ShowEmailDialog property to False and
    PreviewInEmailCleint to True. This is all thoroughly documented in the
    RB help topic for TppEmailSettings.

    3. I suggest taking a look at the article on Email fundamentals before
    continuing. This gives you a good idea about how the email architecture
    works in RB and how it can be utilized.

    http://www.digital-metaphors.com/rbWiki/Output/Email/Email_Fundementals


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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

    thanks a lot for your fast answer.

    The key was to set ShowEmailDialog := False (unfortunately the
    Developer's Guide is missing that line in the simple example).

    The article on rbWiki is also really helpful, thanks.
    Next time I'll look at rbWiki before posting here, sorry for that ^^

    Greets,
    Ben


    Am 03.05.2011 17:50, schrieb Nico Cizik (Digital Metaphors):
This discussion has been closed.