I developed a class for sending emails. My web-app for managing sport-clubs is a multi-client app (many sport-clubs) with muli-roles for each sport-club (trainer, administrator, player, …). One role may send mails to people belonging to other roles of its sport-club.
Each club shall have its own instance of the mailing-class with its own mailing parameters. The class is instantiated when a member of a sport-club logs in. If a mailing is performed, a thread uses the mailing object, a timer checks how many mails were sent and refreshes the result in a label.
By using a thread I can’t use a global session-property as mailing object because this would raise an error. So I declared a global property ‘vMail’ with Type ‘VereinMail’(my class for mailing). If a club logs in, the app instantiates vMail as new VereinMail and stores the parameter needed (username, SMTP-Server, password, mailadress) in regular properties of the object.
// In global module Dim vMail as VereinMail // Sport-Club logs in Dim vMail As New VereinMail vMail.SMTP="smtp.xyz.com" vMail.Mailadress = "firstname.lastname@example.org" ...
Now my question: If more than one sport-club logs in simultaniously, will each club get its own mailing-object or will the object of the first club be globally accessible (which would not be wanted)?