Sending Email with SMTPSecureSocket

Xojo has built-in SMTP support for sending email messages. ServerWarp/1701 hosting customers have a great email service provided to them as part of their hosting plans. To send email using the SMTPSecureSocket via ServerWarp you can use the following code.

First drag a SMTPSecureSocket to your window/webpage or instantiate a SMTPSecureSocket. Be careful if you instantiate one in code that it's a property of an object that will not go out of scope. Sometimes the SMTPSecureSocket goes out of scope while trying to send and the email message never goes out. 

Second use the following code to send an email. Replace the username/password with your email settings.

  smtp.Address = "mail.serverwarp.com"
  smtp.Secure = True
  smtp.Port = 587
  smtp.ConnectionType = 1
  smtp.Username = "user@domain.com"
  smtp.Password = "emailPassword"
  
  Dim mail As New EmailMessage
  mail.FromAddress = "phillip@serverwarp.com"
  mail.AddRecipient("phillip@1701software.com")
  mail.Subject = "Test"
  mail.BodyPlainText = "Test"
  
  smtp.Messages.Append(mail)
  smtp.SendMail()