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

Can multiple SMTP libraries be using in a single application

Hi,

I want to know if it is possible to add multiple SMTP libraries to the 'uses' clause of our Delphi project (i.e. ppSMTPMAPI, ppSMTPOutlook, ppRESTMailGMail, and ppRESTMailOutlook365) as different users of our software will use different email software/products. We want the individual users to be able to select their email software and then enter the appropriate connection/configuration options. If so, how would I go about selecting/enabling the correct SMTP library to use at run-time?

Thanks,
Scott
Thanks,
Scott

Comments

  • Hi Scott,

    You can manually register and un-register email plugins in code using the TppSMTPPlugIn.RegisterClass and TppSMTPPlugIn.UnRegisterClass in the ppSMTPCustom.pas file respectively. See the following article and example for how this can be done.

    http://rbwiki.digital-metaphors.com/output/email/email-fundamentals/

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • If I add multiple SMTP libraries to the 'uses' clause (i.e. ppSMTPMAPI, ppSMTPOutlook, ppRESTMailGMail, and ppRESTMailOutlook365), will all these email plugins be "registered" since there is a TppSMTPPlugIn.RegisterClass in the Initialization of all these units or can only one be "registered" and the TppSMTPPlugIn.RegisterClass handles ensuring only one is registered at a time? I assume that latter and therefore I will need to "register" the one I want to use manually. If you could confirm that to be the case that would be appreciated.
    Thanks,
    Scott
  • Hi Scott,
    I assume that latter and therefore I will need to "register" the one I want to use manually.
    Correct, only one email plugin can be registered at a time. Adding a single plugin reference to the uses clause will automatically register it for convenience however adding multiple will only register the last one loaded.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.