Web app not sending emails after server upgrade

I have my web app send myself and sometimes the user an email. All has been working well prior to the server upgrade which happened yesterday. Now the app does not send the emails. The code below is what I have been using. Do I need to change something with this?

dim fwp As New XojoCloud.FirewallPort(465, XojoCloud.FirewallPort.Direction.Outgoing)
fwp.Open()
If fwp.isOpen() Then
  
  dim mail as EmailMessage
  dim strMessage as String
  
  Dim MailSocket As New SMTPSecureSocket
  MailSocket.Address = "smtp.gmail.com"
  MailSocket.Port = 465
  MailSocket.ConnectionType = SMTPSecureSocket.TLSv1
  
  MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
  MailSocket.Secure = True
  MailSocket.UserName = app.kMailUN
  MailSocket.Password = app.kMailPW
  
  mail = new EmailMessage
  mail.fromAddress = "myemail@xxx.com"
  
  mail.subject = "some email subject"
  
  strMessage = "some email message"
  
  mail.bodyPlainText = strMessage
  
  mail.AddRecipient("myemail@xxx.com")
  
  MailSocket.Messages.Add mail
  MailSocket.SendMail
  
  fwp.Close() // Close port when done
End If

Hi Ryan - I will look into this and get back to you.

1 Like

Much appreciated, Jason!

1 Like

Jason emailed me privately on this. If anyone else was using a similar code to send emails in an XC web app, the trick after the server upgrade is to remove the

If fwp.isOpen() Then

After removing this, and the End If of course, the app now is sending emails both in debug and deployed to XC

Thanks Jason!

2 Likes

I heard back from Jason this morning saying they fixed the IsOpen. I just tested, and it works, so no need to comment out/remove from your projects if using this line to send emails with an XC web app

1 Like

Hi Ryan, I’m glad you posted this or I would have never checked on my own XC apps. As of this moment they are experiencing the same (not working) issue with SMTP - likely opening ports out. Did you need to reboot your server or do anything tricky to get things going after the ‘fix’?

1 Like

I didn’t do anything differently. When I spoke with Jason yesterday, I commented out the if fwp.IsOpen line, and then the emails worked. Today, he said they fixed it, so I uncommented the lines today, rebuilt, and all is good. I did not restart the server

1 Like

Ah, I pushed a new build out, to kill/replace my app and now all seems good. Again, thanks for the heads up - something I need to add to my list to verify after any XC update :+1:t2:

2 Likes

@Ryan_Hartz you should tag this thread with “xojo cloud” as it is a problem specific to xojo cloud
and even reading carefully it’s difficult to understand it applies to XC

thanks.

2 Likes

Not sure what you mean. I checked if I could change the target to XC, but it doesn’t seem like I can edit it

may be xojo team can do it, or MVP’s