Email goes to spam

Posted by VICKY Shastri on Stack Overflow See other posts from Stack Overflow or by VICKY Shastri
Published on 2012-09-19T03:14:13Z Indexed on 2012/09/19 3:37 UTC
Read the original article Hit count: 287

Filed under:
|
|
|
|

i am creating an simple mail sending application in c# windows form application. My application works well but when i send email to my yahoo account it goes to spam not in inbox but if i send email to gmail it goes to inbox. please tell me what i need to do to send email in inbox

below is my code:

try
{
    // setup mail message
    MailMessage message = new MailMessage();
    message.From = new MailAddress(textBox1.Text);
    message.To.Add(new MailAddress(textBox2.Text));
    message.Subject = textBox3.Text;
    message.Body = richTextBox1.Text;

    // setup mail client
    SmtpClient mailClient = new SmtpClient("smtp.mail.yahoo.com");
    mailClient.Credentials = new NetworkCredential(textBox1.Text, "password");

    // send message
    mailClient.Send(message);

    MessageBox.Show("Sent");
}
catch(Exception)
{
    MessageBox.Show("Error");
} 

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET