SMTPSecureSocket error 22 what can it be?

Hi there,

using the xojo example smtpsecuresocket, but with port 587 as given by the provider.
I get error 22 when I try to send an email.
if I add a mailsocket.connect I get no error
tested the server , username, password on webmail is ok.
recipient is the same as username
to email is existing and working
error 22 is " 22 Invalid argument"
any idea where to search to correct this ?


well I tried another provider (ovh and a domain) and … the mail is sent ! :frowning:
so the problem is with the first provider, I asked them for a log of the connexion if any ?

Hi Jean-Yves,

I have some projects that use SMTP (which I’m sure all of us do) and popped in to see if there were any comments I made in the past that might be helpful. However what I found has left me confused.

Below is a snippet from my ‘MailSocket’ code. It uses an SMTPSecureSocket, and even though I’m using port 465 I still thought it might be useful. However, when I compare my code to the online Xojo docs I am confused - there doesn’t seem to be a “ConnectionType” property any longer…? Using auto-complete doesn’t offer it either, and often times when I type a deprecated method or property the IDE warns me and offers a pointer to the replacement - but not in this case. So even though the below code is from a working sample I can’t find any Xojo docs supporting it. Very weird (or perhaps I’m missing something)

EmailSocket = New MailSocket 'SMTPSecureSocket

// Connect to Server
EmailSocket.Address = ""
EmailSocket.Port = 465
EmailSocket.ConnectionType = SMTPSecureSocket.TLSv11
EmailSocket.SMTPConnectionType = SMTPSecureSocket.SMTPConnectionTypes.SSLTLS
EmailSocket.SSLEnabled = True
EmailSocket.Username = ""
EmailSocket.Password = "the_pwd"

now it’s like this with API2 :

MailSocket.Address = ""
MailSocket.Port = 587
MailSocket.SSLConnectionType = SSLSocket.SSLConnectionTypes.SSLv23
MailSocket.SMTPConnectionType = SMTPSecureSocket.SMTPConnectionTypes.SSLTLS
MailSocket.SSLEnabled = True
MailSocket.Username = "user"
MailSocket.Password = "pwd"

Try using the TLS12 constant. That could be your invalid parameter. If the socket is declaring to the server it accepts SSL3 the server could be going nope nope nope!

If you’d use our CURL class in MBS Plugins, it would give you a log.

thanks Tim but I tried the different parameters and it’s still the same error.