Question regarding SMTP

flyingbag

Member
Licensed User
Longtime User
Hello,

I have a main process that needs to send an email and a service module that needs to send another email once some work is done

Quick question:
Should i be initializing SMTP only once in the Main activity ?

I am currently doing the following (declaring SMTP within a sub SendEmail)
This sub is in Main Activity as well as the Service module

Sub SendEmail
dim oSMTP as SMTP
oSMTP.Initialize("smtp.gmail.com", 465, userid, pwd, "SMTP")
oSMTP.UseSSL = True
oSMTP.To.Add("Address")
oSMTP.Subject = "Subject"
oSMTP.Body = "Some Body"
oSMTP.Send
End Sub

Is this the right way to do it? or should i be initializing SMTP object only once in Globals in MAIN?


I have observed that the SendEmail module in MAIN works perfect all the time but sometimes the service module SendEmail is not working as expected. Wondering if reinitializing SMTP is the problem ....
 
Last edited:
Top