using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void username_TextChanged(object sender, EventArgs e)
{
}
private void userplot_TextChanged(object sender, EventArgs e)
{
}
private void userreason_TextChanged(object sender, EventArgs e)
{
}
private void sendrequest_Click(object sender, EventArgs e)
{
string user = username.Text;
string plot = userplot.Text;
string reason = userreason.Text;
string all = user + " - " + plot + " - " + reason;
System.IO.File.CreateText (all);
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Test Mail - 1";
mail.Body = all;
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "**********");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
MessageBox.Show("mail Send");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}

Rewant ChoudharyRank #4,270 · 354 reputationPosted Sep 5, 2012, 2:15 AM EDT
MailMessage mail = new MailMessage();
mail.Bcc.Add("[email protected]");
mail.From = new MailAddress("[email protected]", "WebAccouting");
mail.Subject = "Feedback...!!!";
mail.Body = "body";
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential("GmailID", "password");
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.Send(mail);
Robert Wiedeman5 reputationPosted Sep 5, 2012, 5:08 AM EDT
using System;
Rewant ChoudharyRank #4,270 · 354 reputationPosted Sep 5, 2012, 5:19 AM EDT
mail.Bcc.Add("[email protected]");
mail.From = new MailAddress("[email protected]", "WebAccouting");
mail.Subject = "Feedback...!!!";
mail.Body = "body";
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential("GmailID", "password");
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.Send(mail);
It's tested and working fine.
Note in NetworkCredential are you using gmail id and password or not.
copy and paste and check your network connection also.
what is error can you show me..
Robert Wiedeman5 reputationPosted Sep 5, 2012, 6:28 AM EDT
(Thnx for trying to help me out btw).
Rewant ChoudharyRank #4,270 · 354 reputationPosted Sep 5, 2012, 9:32 PM EDT
Try{
//your code here
label.text="Mail sent";
}
catch(exception ee)
{
messagebox.show(ee.Tostring());
}
now check your inbox and Spam folder also
Thanks