hi
by using this code we can send the mail using the gmail smtp server and this is is very useful if we don't know the name of the smtp server
thank you
MailMessage obj1 = new MailMessage(); obj1.From = "*****@gmail.com"; obj1.To = "*****@gmail.com"; obj1.Subject =txtFrom.Text +" is the sender "+ txtSubject.Text; obj1.BodyFormat = MailFormat.Html; obj1.Body = FreeTextBox2.Text; SmtpMail.SmtpServer = "smtp.gmail.com"; obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "******@gmail.com"); obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "********"); obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465"); obj1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true"); SmtpMail.Send(obj1);
|
No responses found. Be the first to respond and make money from revenue sharing program.
|