Help please: Sending email through Gmail with SMTPSocket1.port = 465

Hello,

I have an app that I use to send emails via google which works well, I am using this code…
I have already configured to use “Less secure apps”

          SMTPSocket1.Secure = True
          SMTPSocket1.ConnectionType = SMTPSecureSocket.TLSv1
          SMTPSocket1.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
          SMTPSocket1.address = "smtp.gmail.com"
          SMTPSocket1.port = 465

I am now using it on a friend’s computer, his computer is using an automatic billing app which communicates with the billing company via the internet.

My app cannot send emails on his computer, I have a progress bar which keeps recycling.

I am of the opinion that my friend billing app is somehow interfering with my app. maybe it is permanently locked into port 465, I am just guessing, is that so?

How can I modify my code above to circumvent this problem? I tried SMTPSocket1.port = 587 but that don’t work.

Any suggestions?

Thanks.

Lennox

Port 587 is TLS, so you connect unencrypted and it upgrades later.
For port 465 you connect with encryption turn on for the first packet.

So did you try 587 and maybe leave connection type to unencrypted?

Thanks Christian,

I am not quite familiar with that type of coding and would appreciate if you can modify this code for me

SMTPSocket1.Secure = True SMTPSocket1.ConnectionType = SMTPSecureSocket.TLSv1 SMTPSocket1.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS SMTPSocket1.address = "smtp.gmail.com" SMTPSocket1.port = 465

Thanks.

Lennox

This worked for me (port 587 gmail):

SMTPSocket1.address = "smtp.gmail.com" SMTPSocket1.port = 587 SMTPSocket1.ConnectionType = SMTPSecureSocket.TLSv1 SMTPSocket1.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS SMTPSocket1.Secure = False

I normally use .Port = 465 and .Secure = True

Thanks Alberto,

That works on my system so I will try it on his system sometime next week. I will not use “This answer my question” at this time but after I try it on his system and it works then I’ll do so.

One questions…
Can an app take control continuously of a port and prevent another app from using that port? or does it only connect when requested and after the email is sent it then disconnects and makes that port available for another app to use the same port?

Thanks again.

Lennox

Lennox, because you are connecting to an external server (smtp.gmail.com) I don’t think a local app can take control of the port. This is different as having an app as a local service using X port.

Maybe a local firewall/antivirus in that machine is not letting your app connect to external server at port 465?

Hi Alberto,

I am thinking that too… “Maybe a local firewall/antivirus in that machine is not letting your app connect to external server at port 465?” because I saw a message box indicating that “malware” has been detected, so I advised him to have that issue corrected.

Thanks again.

Lennox

Hi Alberto,

Both codes work now 465 and 587 and stated above, I don’t know what was the problem, so I nevertheless checked your answer as “This answers my question”.

Thanks again.

Lennox