Email and SMTPSecureSocket - can't send emails

I have a desktop app that is supposed to send me notification emails. I am using my own server to send. It tried using gmail, but its now complicated with 2 step authentication, so went back to my own email server.

It works fine on my machine, when I run the app through the XOJO IDE, or the built version, wrapped (sandboxed) and unwrapped.

Problem is, it does not work from other people’s machines.

I set up my socket in my App’s Open event (username and password deleted for this forum):

//set up the mail server for the survey using gasbag server theMailServer = New SMTPSecureSocket theMailServer.Address = "host.gasbag.net" theMailServer.Port = 587 //use 587, NOT 465 theMailServer.Username = "******" theMailServer.Password = "******" theMailServer.ConnectionType = 3 theMailServer.Secure = True

The email is sent when a form is completed in a different part of the app:

[code] //compose the feedback string
Dim mail As New EmailMessage, feedback as string
feedback = “****” // string gets composed, code deleted for this forum post

//send the message
mail.subject= “New QuickBAS Feedback”
mail.bodyPlainText = feedback
mail.addRecipient “info@quickbas.net.au”
mail.FromAddress = “info@quickbas.net.au”
app.theMailServer.Connect
app.theMailServer.messages.append mail
app.theMailServer.sendMail[/code]

Why can I send from my own machine, but nobody else can send?

Except that the recipient is equal to the sender I don’t see anything wrong.

Have you tried with SMTPConnectionMode?
Socket1.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS

Do you have code in the error events? If yes, do you get an error?

Do you get the mail sent event? How does the code look there?

make sure ConnectionType is one of the TLS types. Most servers don’t allow plain SSLv3 any more.

Is the server firewall set to only allow whitelisted IP addresses?

I have just now sent and received back a mail (gmail), configured as:
server: smtp.gmail.com
Port = 465
SSL v. 23
Secure = True
no authentication

BTW: I do not know if nowadays it is the recommended way, but at least it still works.

@Carlo: this depends on the security settings in Gmail. Google Apps users can’t use “low security” at all.

@Beatrix: Are you referring to ?
(I know that 2 steps verifications is recommended, yet I kept my account at low security).

Gmail has 2 authentications they are calling 2 factor authentication. “Normal users” do what your link is referring to. Google Apps users have a certificate that Google is calling 2 factor authentication, too. I’ve tried to set this up. When Apple and Microsoft are sometimes hard to understand then Google is completely insane.

See http://www.example-code.com/xojo/imap_gmail_oauth2.asp and http://www.chilkatforum.com/questions/9368/oauth2-gmail-authentication-fails.

Also, I don’t like to tell my customers that they have to change something.

Thank you all for the replies. In response:

@ Beatrix Willius

  1. recipient address = sender address - because its a form being sent from my app to me. I might trial a different sender address.

  2. SMTPConnectionMode - is that in addition to ConnectionType?

  3. I can’t access errors, because it works fine from my own machine. Only 3rd parties can’t send (and therefore I can’t get error messages)

  4. I’m not using Mail Sent event.

  5. ConnectionType = 3 is TLSv1, not SSL

  6. Server firewall - this makes more sense as it seems to be a server issue, not an app issue. I will investigate.

Many thanks again. Will report results.

What panel is on the server?
cPanel,plesk etc?

I’ve just had a thought.

The form Send button (and action) is on a separate sheet window. When a third party user clicks on the Send button, its the last thing the user needs to do on that window, and I assume they immediately close the window. Maybe that does not give the sendmail method enough time to actually send the email.

When I am testing, I click the Send button, and don’t close the Window because I go to my email client to see if it has sent/received.

If this is the case, how can I give the sendmail method enough time to send, even if the user closes the containing window?

[quote=261941:@Loannis Kolliageorgas]What panel is on the server?
cPanel,plesk etc?[/quote]
Apache with cpanel

My tip.
check the settings for
Maximum number of connections (IMAP, POP3, IMAP over SSL, or POP3 over SSL) ?
Maximum number of connections per IP address ?
Relaying ?
Server-wide mail ?
All above some times in cpanel and plesk restrict the server from send new mails…
Also check Outgoing mail mode ?
Is from specific IP or by domain ip?
Some times there is problem with Dns blacklist no by your server but from isp.
Also check your static ip if is blacklisted or from customer (user)?
ip check blacklist

Put the code in module and use a timer?
Check this post

[quote=261946:@Loannis Kolliageorgas]My tip.
check the settings for
Maximum number of connections (IMAP, POP3, IMAP over SSL, or POP3 over SSL) ?
Maximum number of connections per IP address ?
Relaying ?
Server-wide mail ?
All above some times in cpanel and plesk restrict the server from send new mails…
Also check Outgoing mail mode ?
Is from specific IP or by domain ip?
Some times there is problem with Dns blacklist no by your server but from isp.
Also check your static ip if is blacklisted or from customer (user)?
ip check blacklist[/quote]
Thanks Loannis, but I can’t find those parameters in cpanel. Are they more server-wide (WHM)?

To check the mails

Home >> Email >> View Sent Summary

Mail settings

Home >> Service Configuration >> Mailserver Configuration

Tweak service

Home >> Server Configuration >> Tweak Settings

[quote=261942:@Rob Lang]I’ve just had a thought.

The form Send button (and action) is on a separate sheet window. When a third party user clicks on the Send button, its the last thing the user needs to do on that window, and I assume they immediately close the window. Maybe that does not give the sendmail method enough time to actually send the email.[/quote]

On second thought, that can’t be the problem. my sendmail method refers to an SMTPSecureSocket that is instantiated in the app Open event, not within the window. So even if the user closes the sheet window, the app is still running. Only if the user immediately closes the entire app will the sendmail not have time to send.

[quote=261950:@Loannis Kolliageorgas]To check the mails

Home >> Email >> View Sent Summary

Mail settings

Home >> Service Configuration >> Mailserver Configuration

Tweak service

Home >> Server Configuration >> Tweak Settings

I have none of those options on my cpanel (version 54.0.21). I will go into WHM and make sure I’m running the latest cpanel and I have enabled all options.

@Beatrix: [quote]Gmail has 2 authentications they are calling 2 factor authentication. “Normal users” do what your link is referring to. Google Apps users have a certificate that Google is calling 2 factor authentication, too. I’ve tried to set this up. When Apple and Microsoft are sometimes hard to understand then Google is completely insane.[/quote]

Answer most appreciated. Besides, I had not noticed that the post was not referring to Xojo.POPsockets.
Thank you.

OK I found those settings in my server-wide WHM panel.