Error: the SMTP server requires a secure connection or the client was not authenticated
<pre><code>    private void button9_Click(object sender, EventArgs e)
    {
        try
        {
            MailMessage mail = new MailMessage(from.Text, to.Text, pswd.Text, subject.Text);
            SmtpClient newclient = new SmtpClient(smtp.Text);
            newclient.Port = 587;
            newclient.Credentials = new System.Net.NetworkCredential(username.Text, body.Text);
            System.Net.Mail.Attachment attachment;
            attachment = new System.Net.Mail.Attachment(pathname);
            mail.Attachments.Add(attachment);
            newclient.EnableSsl = true;
            newclient.Send(mail);
            MessageBox.Show("Mail Sent!", "Success", MessageBoxButtons.OK);
       }
       catch (Exception x)
       {
           MessageBox.Show(x.Message,"Error");
       }
    }

    private void button8_Click(object sender, EventArgs e)
    {
        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            this.Text = openFileDialog1.FileName;
            pathname = this.Text;
        }
    }
</code></pre>
