Thanks Wayne, that was it!
YOU never pass anything
It needs to be declared with an instance as the first parameter as that's how the RUNTIME calls whatever event you're defining
You never call this event directly so YOU never pass anything
The runtime calls the event this way
Thats why I asked what MailSent looked like
Here's the code where the email gets sent.
SMTPServerMail is a Property, Type SMTPSecureSocket
In the window open event:
SMTPServerMail = New SMTPSecureSocket AddHandler SMTPServerMail.MailSent, AddressOf MailSentEvent
In a method the Mail is sent:
SMTPServerMail.Address = "localhost" 'csBulkMailSMTPServerMail SMTPServerMail.Port = 25 'cnBulkEmailPort SMTPServerMail.Username = "" 'csBulkMailSMTPUserID SMTPServerMail.Password = "" 'csBulkEmailSMTPPassword System.DebugLog("Last Error: " + Str(SMTPServerMail.LastErrorCode) ) Msg.AddRecipient csEmailAddress System.DebugLog("Sending email to: " + csEmailAddress) Msg.subject = "Application Form - " + rs.Field("lastName").StringValue + ", " + rs.Field("firstName").StringValue + " " + rs.Field("middleName").StringValue Msg.BodyHTML = CreateMsg() SMTPServerMail.Messages.Append( Msg) Call UpdateTransaction("", "", "Sending App") SMTPServerMail.SendMail
Have I missed something?
ah so only the event that is when all mails have been sent isnt firing
there's only one email though ?
bytes left to send is for one message so maybe poll like
While SMTPServerMail.Messages > 0 SMTPServerMail.Poll Wend MsgBox("Out of Polling")
What I'm trying to do is after the email is sent, write a confirmation to the database that an email has been sent. There have been a few instances where the email did not get sent. I believe it has to do with some server issues.
Can you think of way to get this fixed?