title: How to send automatic emails on click event from UWP/Windows Store app (2019) without using email interface but using Yahoo SMTP
body: <p>Trying to send an automatic email from UWP/Windows Store (2019) app using yahoo smtp and without email interface popping up on click event.  </p>
  
  <ul>
  <li>Does anyone have the code for this?  I will be using static from and to email addresses.  </li>
  <li>This needs to work regardless of where the app is installed, i.e. multiple PCs.</li>
  </ul>
  
  <p>I have tried <strong>LightBuzz</strong> NuGet Package using this and it still does not send any emails nor does the app crash or gives errors:</p>
  
  <pre><code>using LightBuzz.SMTP;
  
  // The below call to SendMailAsync is used in a click event
  SendMailAsync();
  // 
  
  public async static void SendMailAsync()
          {
              var server = "smtp.mail.yahoo.com";
              var port = 587;
              var ssl = true;
              var username = "myemail@yahoo.com";
              var password = "myPassword"; 
  
              using (var client = new SmtpClient(server, port, ssl, username, password))
              {
                  var emailMessage = new EmailMessage();
  
                  emailMessage.To.Add(new EmailRecipient("myemail@yahoo.com"));
                  emailMessage.CC.Add(new EmailRecipient(""));
                  emailMessage.Bcc.Add(new EmailRecipient(""));
  
                  emailMessage.Subject = "My Subject";
                  emailMessage.Body = "My Msg.";
  
                  await client.SendMailAsync(emailMessage);
              }
          }
  </code></pre>
  
  <p>I expect the email to arrive in my yahoo mailbox. But nothing ever comes.</p>