Error 22 "Invalid Argument" when sending mail

In my app I’m sending mails to me and a copy to the user when the app has a problem. This works for most customers. But some have an error 22 “Invalid Argument”. The Internet says only strange things about this error. I found an old post from Charles Yeomans in 2009 that this means the following:

But I’m getting this on first send.

[code] socket1.address = “
socket1.port = 25
socket1.username = username
socket1.password = password

dim theMessage as new emailMessage
theMessage.fromAddress = TFName.Text + " <"+ TFEmailAddress.Text.Trim + “>”
theMessage = “Error Report”
theMessage.AddRecipient recipient

socket1.messages.append theMessage

Latest version of Xojo, Cocoa, Mac OS 10.9.

Port 25 is blocked in some networks, you should try a workaround, like a retry on an alternative port (like 587) when the port 25 fails. This is probably a “can’t connect” error instead of a “connection dropped”.

More likely, “connection rejected”.

Beatrix did you ever get this resolved. I suddenly have a user with the same problem.

[quote]My resolution
Oddly enough my client’s ISP seems to be doing some sort of port blocking of port 25. If I change to an alternate port it seems to work fine.[/quote]

Rick was correct. The port needed to be changed to 587.