Build a function that sends mail by gmail c#
<pre><code> public void SendMail(string Subject, string Body, MailAddress To)
    // מטודה מקבלת פרטי מייל בודד ושולחת אותו
    {
        var fromAddress = new MailAddress("israel.nahum@gmail.com");
        var toAddress = To;
        string fromPassword = "46798513";
        string subject = Subject;
        string body = Body;

        var smtp = new SmtpClient
        {
            Host = "smtp.gmail.com",
            Port = 587,
            EnableSsl = true,
            DeliveryMethod = SmtpDeliveryMethod.Network,
            UseDefaultCredentials = false,
            Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
        };
        using (var message = new MailMessage(fromAddress, toAddress)
        {
            Subject = subject,
            Body = body
        })
        {
            smtp.Send(message);
        }
    }
</code></pre>

<p>What I do is actually get a few miles from the List Box, all mail sent into this function, the function reaches the last line of sending the SMTP and then returns an error! What could be the problem function? Has a proposal how to write it down otherwise please I need help!</p>
