Is there a work around google disabling “Less secure apps”?

You could try authentification via “App password”.

On your Google account:

  1. set 2-Step Verification ON

  2. create 16-character “App password”(
    How to create app password) -> result should be similar to:
    16-character “App password”

  3. Instead of Google account password use 16-character password

    MailMessage mail = new MailMessage();
    foreach (string receiver in DolociPrejemnike())
        mail.To.Add(receiver);
    mail.From = new MailAddress("[email protected]", "No replay"); //pošiljatelj (vedno enak)
    mail.Subject = SetSubject();
    mail.Body = SetBody();
    mail.IsBodyHtml = true;
    
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "smtp.gmail.com";
    smtp.Port = 587;
    smtp.UseDefaultCredentials = true;
    smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "xtqapucsmyvqmvxp"); // Enter seders User name and password  
    smtp.EnableSsl = true;
    smtp.Send(mail);
    

Leave a Comment

tech