I have a desktop app which works perfectly in Windows, but fails on MAC OSX.
My app tests for a valid SMTP connection, then sends an email via my Gmail account.
The following code works fine on any Windows build:-
[code] // Establishes a test connection
ProgressBarSMTP.Maximum = 0
ProgressBarSMTP.Visible = True
Dim mySMTP As new SMTPSecureSocket
//Dim test As new EmailMessage
If chkSSL.Value = True Then
mySMTP.Secure = true
mySMTP.Secure = False
mySMTP.ConnectionType = 1
mySMTP.Address = txtMailServer.Text
mySMTP.Username = txtMailUsername.Text
mySMTP.Password = txtMailPassword.text
ProgressBarSMTP.Visible = false
If mySMTP.IsConnected = True Then
MsgBox("Connection verified OK. ")
MsgBox("Connection failed! " +Cstr(mySMTP.LastErrorCode))
When this runs under a MACOS build, I receive a “Connection failed!” message, but the LastErrorCode is 0
Help!! What am I doing wrong?
Further to the above, the MacBook that I am testing the build on, is running 10.8 Mountain Lion.
I can confirm that the Mac’s own Mail app is working, and I am able to send emails via my Gmail account by SMTP.
So really cannot figure out why my Xojo built app cannot connect with the gmail server??
Maybe on OS X it takes a little bit more time to connect than on Windows. After
mySMTP.Connect() add the following code:
loop until (mySMTP.IsConnected or (mySMTP.LastErrorCode <> 0))
This is always a good idea, not only on OS X.
GMail needs the ConnectionType.
mySMTP.ConnectionType = 2
what port number are you using? tony
Carsten Belling you are my savior!!! Thanks so much for your advice. This tip WORKS
I had tried various Connection Types, and various ports - all failed on mac, but worked on Windows. I had not considered the timing issue.
I’m soooo happy - spent hours trying to figure this out…
Gmail SMTP server address: smtp.gmail.com
Gmail SMTP user name: Your full Gmail address (e.g. email@example.com)
Gmail SMTP password: Your Gmail password
Gmail SMTP port: 465
Gmail SMTP TLS/SSL required: yes
someone also mention make sure the ‘email from’ and ‘email to’ is not the same