Home General

How To...Customize Indy Email Settings

edited April 2011 in General
Hi I have been reading the above mentioned subject on RBWiki

Lets say that I am letting the user configure SMTP-server and port.
Will the suggested solution - with SSL IOhandler - work on email servers
that does NOT require TLS encryption ?

Ren? /SSV

Comments

  • edited April 2011
    Hi Rene,

    The purpose of the article is to show how to gain access to the
    underlying Indy (TidSMTP) object. Once you have access to this object,
    anything that is possible with a stand-alone Indy project, should be
    possible in ReportBuilder. My suggestion would be to create a test
    application (no RB) and try to successfully connect a TidSMTP component
    to your server and send an email message. Once you have this done, move
    the settings to the RB application.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Hi Nico
    Doesn't RB add some logic and/or error-handling ?
    If I test different settings with TidSMTP I sometimes get timeout - but with
    the same setting via RB it works::

    Example:
    utUseExplicitTLS with TIdSMTP-app -> Timeout
    utUseExplicitTLS with RB-app -> Message sent (and received)

    utUseRequireTLS port 587 with TidSMTP-app -> Timeout
    utUseRequireTLS port 587 with RB-app -> Message sent (and received)

    But:
    utUseRequireTLS port 25 with TidSMTP-app
    AND
    utUseRequireTLS port 25 with RB-app -> Message sent (and received)

    Ren?

  • edited April 2011
    Hi Rene,

    When using the RB email feature, the email itself and report attachment
    are defined in the TppEmail class. Then the TppEmail class calls the
    SendMail routine of the SMTP plugin. If you open the ppSMTPIndy10.pas
    file you can see exactly how ReportBuilder is handling the TidSMTP
    object. In a stand alone app, you would so something very similar.


    Regards,

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

    Best Regards,

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

    Well know I know the difference.

    The code example (from rb-wiki) only works when using Sendmail directly.
    I does not work with this code....

    ppNota.Template.LoadFromFile;
    ppNota.DeviceType := dtPDF;
    ppNota.ShowPrintDialog:= false;

    ppNota.Emailsettings.Clear;
    ppNota.Emailsettings.Enabled:= true;
    ppNota.EmailSettings.DeleteFile := False;
    ppNota.EmailSettings.Subject := 'Invoice ';
    ppNota.Emailsettings.HostAddress:= MySMTPserver
    ppNota.Emailsettings.FromAddress:= MymailAdresse;
    ppNota.Emailsettings.Body.Text := MyMailbody;
    TppSMTPIndy(TppEmail(ppNota.Email).SMTP).IndySMTP.Port:= MySMTPport;

    ppGroup1.GroupFileSettings.Emailfield:= 'F_MailTil';
    ppGroup1.GroupFileSettings.Emailfile:= true;
    ppGroup1.GroupFileSettings.Newfile:= true;

    ppNota.TextFilename:= MyPDFDir+'\Invoice';
    ppNota.Print;

    How can I make it work (setting port) when utilizing RB's implicit mail upon
    Group-break ?

    Ren?

  • edited April 2011
    Hi Rene,

    This is currently a limitation of the Email-Groups feature. The
    FileDevice uses it's own TppSMTPCustom object to send each group as a
    separate file. This object is not exposed so it cannot be altered. I
    will expose this for the next release of ReportBuilder.

    Currently you would need to alter the RB source to gain access to the
    email plugin attached to the FileDevice (i.e. expost the FSMTPCustom
    field as a public property). This however would involve altering the
    Interface section of the ppFilDev.pas file which would then render RAP
    and Server un-usable.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    > This is currently a limitation of the Email-Groups feature. The

    Hmm, Bad news. We were relying on this possibilty in our update.
    When will next release be ? Is it possible to get a pre-release ?
    or ...
    ... are you saying here that I can do it myself if we are not using RAP
    and/or server (which we are not) ?
    I would prefer your release, so I wouldn't have to change anything when
    updating.
    But I may have to do this.

    Finally, wouldn't it be easier to extend emailsettings with SMTPport ?

    Ren?
  • edited April 2011
    Hi Rene,


    Yes, if you expose the FSMTPCustom object of the TppFileDevice class,
    you can then access the Indy TidSMTP object used when emailing groups.

    This is a temporary simple fix to get you up and running. We will take
    a look at our options and provide the ability to do this for the next
    release of ReportBuilder.


    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    Hi again...
    (Been away from this for awhile)

    I have located the FSMTPCustom object in ppFilDEv and I can publihs this.
    But where or when would you suggest that I manipulate the smtp-port of the
    object ?
    In some event (which?)
    Inside ReportBilder-code (where?)

    Regards
    Ren?/SSV


  • edited April 2011
    Hi Rene,

    I would suggest using an event such as the Report.OnFileDeviceCreate.


    Regards,

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

    Best Regards,

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

    Yes, Thank You !
    Actually I just found that myself - and it is working.
    So thank you again. We can now offer our promised update to our customers !

    Ren?/SSV

This discussion has been closed.