Possible Duplicate:
Sending email in .NET through Gmail
I am trying to send a mail with Asp.Net (MVC3) through an GMail-account i've created. I've crawled the internet for how-to's, but nothing i tried has been working.
I have a method that looks like this
public static bool SendEmail(string to,string subject,string body)
    {
        try
        {
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress("myaccount@gmail.com");
            mail.To.Add(to);
            mail.Subject = subject;
            mail.Body = body;
            mail.IsBodyHtml = false;
            SmtpClient smtp = new SmtpClient();
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.Credentials = new System.Net.NetworkCredential("myaccount@gmail.com", "mypassword");
            smtp.EnableSsl = true;
            smtp.Send(mail);
            return true;
        }
        catch
        {
            return false;
        }
    }
This method returns false when im using it. How can i solve this?
 
     
     
     
    