Followed instructions from Documents on EMail

Of course email is Nil. Without new-ing it, it will be Nil.

As I said:

  1. add the properties to the window.
  2. new them in your code.
email      = new EmailMessage
MailSocket = new SMTPSecureSocket

I have a program that send mail and the code is basically the same as yours (other server, port, login, pass)

The only difference I see is, instead of this:

MailSocket.ConnectionType = SMTPSecureSocket.TLSv1
MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
MailSocket.Secure = True

I just have this:

MailSocket.ConnectionType = SMTPSecureSocket.TLSv12

I hope you can make it work. If not, share a sample without personal information (password) and someone will take a look at your code.

Okay, did the New as per instruction, still doesn’t seem to work…

// *********** JHGC ************
' Ian McDonald - Develper/Maintainer
' (999) 999-9999
' ian.mcdian@someplaceintheethers.org
' Delete Microsoft! Go Penquin Computing!
// *********** JHGC ************

// Variable Declarations
Var blnTest As Boolean = modSysFunc.mthEmailCheck( txtVendorEmail.Value.ToText )
MailSocket = New SMTPSecureSocket
email = New EmailMessage

// Code in Action!
If( blnTest = True ) Then
  MailSocket.Address = "smtp.joyfulheartgardens.com" '  "smtp.gmail.com"
  MailSocket.Port =  143 ' 465
  MailSocket.ConnectionType = SMTPSecureSocket.TLSv1
  MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
  MailSocket.Secure = True
  MailSocket.UserName = "mali@joyfulheartgardens.com"
  MailSocket.Password = "***************"
  
  email.FromAddress = "mali@joyfulheartgardens.com"
  email.Subject = "Hello, world!"
  email.BodyPlainText = "I love Xojo! But it can be a PITA sometimes! :)"
  email.AddRecipient( "ian.mcdian@zoho.com" )
  
  MailSocket.Messages.AddRow( email )
  MailSocket.SendMail
  MessageBox( "It clicked... did it werk?" )
  
Else
  MessageBox( "Apparently you do not know how to write an email address..." )
  Exit
End If


'MessageBox( "I am still sorting out the intricities of sending an email from my own software...." )

I suggest you add event handlers for all the events that can happen for MailSocket, and see which ones fire and what they report.

1 Like

Not always…