Tell me if there is something wrong with email routine

This has been working fine. Had to make a change somewhere else in program, now this doesn’t seem to work.

The SMTPSecureSocket is a SMTPSecureSocket dropped on the form.
This is Web running on a linux server. Developing on a Mac.

Is there anything wrong?


SMTPMail = New SMTPSecureSocket
if not DebugBuild then
  
  SMTPMail.Address = "localhost" 'csBulkMailSMTPMail
  SMTPMail.Port = 25 'cnBulkEmailPort
  SMTPMail.Username = "" '""   'csBulkMailSMTPUserID
  SMTPMail.Password = ""   'csBulkEmailSMTPPassword
else
  
  SMTPMail.Address = csBulkMailSMTPMail
  SMTPMail.Port = cnBulkEmailPort
  SMTPMail.Username = csBulkMailSMTPUserID
  SMTPMail.Password = csBulkEmailSMTPPassword
  SMTPMail.Secure = True
  SMTPMail.ConnectionType = SMTPMail.SSLv23     'SSLv3
  
end


' Not needed when deployed
'SMTPMail.ConnectionType = SMTPSecureSocket.SSLv2
'SMTPMail.Secure = True
'SMTPMail.Connect

System.DebugLog("Last Error: " + Str(SMTPMail.LastErrorCode) )

Dim x As Integer

LoadEmails
For Each email As String In msEmailAddress
  Msg.AddRecipient email
Next
'Msg.AddRecipient msEmailAddress
'Msg.AddCCRecipient msUserEmail
Msg.FromAddress = "ASPE Education <education@aspe.org>"


Msg.subject = Session.gsItemTitle + " Registration for " + rs.Field("ALName").StringValue + ", " + rs.Field("AFName").StringValue + " [" + Session.gsKind + "] "
Msg.BodyHTML = CreateMsg()
Msg.headers.appendHeader "X-Mailer","ASPE WEbinar Registration"
If Msg.BodyHTML = "" then Return

SMTPMail.Messages.Append( Msg)
SMTPMail.SendMail

The beloved “now this doesn’t seem to work”. What doesn’t work? The mail doesn’t get sent? Do you have an error?

My favourite idiocy at the moment is blocking all connections with Little Snitch and then I wonder why I can’t connect to my IMAP accounts.

lol, the emails don’t seem to get sent out. Either in debug or production.

I don’t thin little snitch is running on the web server, and I know I don’t have it.

Does SMTPMail go out of scope at the end of this code? Send mail takes time to run and may not have time to finish.

What error codes do you get in error event?

No Error codes.

The SMTPSecureSocket is a SMTPSecureSocket dropped on the form.
That thought came to me too as it was working.

I did have this after the send and set mbMailSent in the MailSent event, but it never exited the loop.

While not mbMailSent 
  app.DoEvents
  System.DebugLog("-+-")
wend

Have you tried a subclass SMTPSecureSocket and implement the Events? This way you can get additional information along the process (for example the EHLO message, errors, message sent or lot processed…). By the way… I found LittleSnitch very useful in order to see that there is an active connection to the SMTP server in the other side… and the amount of bytes sent, for example.

Javier

I have the events implemented as the SMTPSecureSocket was dropped on the form.

If you talking about something else then you lost me.

Were you able to solve your problem?

No it is still driving me crazy!

Might not be anything wrong with your code.
Did the ISP change the allowed outbound port and/or secure connection type?
That can happen without your getting a notice. I ran into a mysterious failure of mail services in one of my server apps.
The ISP had quietly changed the outbound mail port and type of secure connection required.

Had to switch to port 587 and SSLSocket.TLSv1 for things to work again.

You could try with MBS Plugin and get a detailed log from the curl functions.

For secure socket the port must be 465 i thing

Did you implement the error and servererror events? If so what did they turn up?

Have you tried to change the port to 587? Can you see the connection being made at all? How much logging does Xojo do? Have you tried Curl or the Chilkat plugin? The latter can show in detail what happens. Don’t know about the Curl plugin from MBS. Have you waited long enough to get a timeout?

Nothing changed on the server. Other programs using same code is working.

@Christian Schmitz

Is your curl plug in a better way to go for email? Can you point me to a sample?

I only use curl for sending and receiving emails.

See CURLEmailMBS class

@Christian Schmitz

How would you add multiple emails with e.AddT

Just build 1 string with “;” between emails?

When you made the change did you rebuild it with the exact same version of Xojo?

Yes