MailAddress SendFrom = new MailAddress("brijesh.singh879@gmail.com", "Brijesh");
MailAddress SendTo = new MailAddress("brijesh.singh879@gmail.com");
System.Net.Mail.MailMessage MyMessage = new System.Net.Mail.MailMessage(SendFrom, SendTo);
MyMessage.IsBodyHtml = true;
MyMessage.Subject = "Send Mail with attachment ";
MyMessage.Body = "Body";
if (fupResume.HasFile)
{
string FileName = Path.GetFileName(fupResume.PostedFile.FileName);
MyMessage.Attachments.Add(new Attachment(fupResume.PostedFile.InputStream, FileName));
}
System.Net.NetworkCredential authentication = new System.Net.NetworkCredential("brijesh.singh879@gmail.com", "password");
SmtpClient client = new SmtpClient("smtp.gmail.com", 25);//587
client.EnableSsl = true;
client.UseDefaultCredentials = true;
client.Credentials = authentication;
client.Send(MyMessage);
MailAddress SendTo = new MailAddress("brijesh.singh879@gmail.com");
System.Net.Mail.MailMessage MyMessage = new System.Net.Mail.MailMessage(SendFrom, SendTo);
MyMessage.IsBodyHtml = true;
MyMessage.Subject = "Send Mail with attachment ";
MyMessage.Body = "Body";
if (fupResume.HasFile)
{
string FileName = Path.GetFileName(fupResume.PostedFile.FileName);
MyMessage.Attachments.Add(new Attachment(fupResume.PostedFile.InputStream, FileName));
}
System.Net.NetworkCredential authentication = new System.Net.NetworkCredential("brijesh.singh879@gmail.com", "password");
SmtpClient client = new SmtpClient("smtp.gmail.com", 25);//587
client.EnableSsl = true;
client.UseDefaultCredentials = true;
client.Credentials = authentication;
client.Send(MyMessage);