SMTPSecureSocket Security Question.

I’m trying to send email through SMTPSecureSocket using my gmail account but it’s being blocked and flagged as a less secure app. What are the settings I need to use to get around this? These settings always worked fine for me before. Thanks.

Dim SckEmail As New sckMail ' Prepare the SMTP Socket SckEMail.ConnectionType = 3 SckEMail.Secure = True SckEMail.SMTPConnectionMode = 0

This is the code from Examples/Communication/Internet/EmailSSLExample which works with Gmail for me:

// set up the socket MailSocket.Address = ServerField.Text MailSocket.Port = 465 MailSocket.ConnectionType = SMTPSecureSocket.TLSv1 MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS MailSocket.Secure = True

[quote=338493:@Paul Lefebvre]This is the code from Examples/Communication/Internet/EmailSSLExample which works with Gmail for me:

// set up the socket MailSocket.Address = ServerField.Text MailSocket.Port = 465 MailSocket.ConnectionType = SMTPSecureSocket.TLSv1 MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS MailSocket.Secure = True[/quote]

Hmmmmm. Ok

So I’m using port 587 and SMTPConnectionMode = ModeSTARTTLS those are the only two differences.

I’ll give that a shot.

@Paul Lefebvre

Nothing… Still can’t send email using my gmail account. Like I said, a few months ago the last time I tried to use SMTPSecureSocket my original code example worked fine.

SckEMail.address = "smtp.gmail.com" SckEMail.port = 465 'or 587 SckEMail.ConnectionType = SMTPSecureSocket.TLSv1 SckEMail.Secure = True SckEMail.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS

Ok so after doing some more testing I’ve found that the only way I can send email through gmail is by turning this setting on.

I tested with each TLS setting and I also tried using the EmailSSLExample project. If I turn that setting on this code works and the example project starts working.

SckEMail.address = "smtp.gmail.com" SckEMail.port = 587 SckEMail.SMTPConnectionMode = SMTPSecureSocket.ModeSTARTTLS SckEMail.ConnectionType = SMTPSecureSocket.TLSv12 'TLSv1 and TLSv11 SckEMail.Secure = True

Does anyone know the right settings to use to get this working without turning the less secure apps setting on? :confused:

@Paul Lefebvre
@Greg O’Lone

I think you would need to implement oAuth: https://security.stackexchange.com/a/72371

Thanks @Tim Parnell much appreciated.