Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
suppose,
i send message to another e-mailid .....
Posted
Comments
kishore Rajendran 27-Mar-12 7:38am    
Please do atleast single google search before posting.

 
Share this answer
 
public void SendMail(string message, string Reciever, string Sender, string Password, string Subject, Boolean IsHtml)
{
try
{
string strFinal = string.Empty;
String FromEmailId = Sender;`
String EmailPwd = Password;

if (Reciever != string.Empty)
{
if (CheckEmail(Reciever).Equals(true))
{
System.Net.Mail.MailMessage objEmail = new System.Net.Mail.MailMessage(FromEmailId, Convert.ToString(Reciever));
objEmail.From = new System.Net.Mail.MailAddress(FromEmailId);
objEmail.Subject = Subject;
strFinal = message;
objEmail.IsBodyHtml = IsHtml;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.googlemail.com", 587);
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential(FromEmailId, EmailPwd);
objEmail.Priority = System.Net.Mail.MailPriority.High;
client.EnableSsl = true;
objEmail.Body = strFinal;
client.Send(objEmail);
}

}

}
catch (Exception ex)
{

}
}
 
Share this answer
 
Please follow the link and let me know if you need further help

http://msdn.microsoft.com/en-us/library/t7980f5h(vs.71).aspx[^]

http://weblogs.asp.net/ashicmahtab/archive/2009/04/28/how-to-send-emails-from-net-example-uses-gmail-smtp.aspx[^]
 
Share this answer
 
try this
MailAddress mailfrom = new MailAddress ( "frommail@gmail.com" );
           MailAddress mailto = new MailAddress ( "tomail@gmail.com" );
           MailMessage newmsg = new MailMessage ( mailfrom, mailto );
           newmsg.Subject = "Subject of Email";
           newmsg.Body = "Body(message) of email";
           ////For File Attachment, more file can also be attached
           Attachment att = new Attachment ( "G:\\code.txt" );
           newmsg.Attachments.Add ( att );
           SmtpClient smtps = new SmtpClient ( "smtp.gmail.com", 587 );
           smtps.UseDefaultCredentials = false;
           smtps.Credentials = new NetworkCredential ( "urmail@gmail.com", "urpwd" );
           smtps.EnableSsl = true;
           smtps.Send ( newmsg );
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900