Regards, Sheo Narayan http://www.dotnetfunda.com
mailMsg.To = "gnkt4ujt2002@gmail.com" mailMsg.From = "u@gmail.com" ' mailMsg.To = "6@dweb.com" ' mailMsg.From = "tgtbr@dweb.com" 'mailMsg.BodyFormat = MailFormat.Text 'optional for sending text in body mailMsg.BodyFormat = MailFormat.Html mailMsg.Subject = "Statistics Report" mailMsg.Body = "<html><body><Table><tr><td>Hi,</td></tr><tr><td>Details of the Statistics :</td></tr></Table></body></html><html><body>" & "sometext" & _ "</body></html><html><body><Table><tr><td> </td></tr><tr><td>NOTE: This is an automated mail. Please, do not reply.</td></tr>" & _ "<tr><td>*Green coloured rows indicates temporary demos</td></tr>" & _ "<tr><td>**All statistics are based on the page naming conventions Eg., 22_10_2005_</td></tr>" & _ "<tr><td> </td></tr><tr><td>Regards,</td></tr><tr><td>some text,</td></tr><tr><td>some text,</td></tr>" & _ "<tr><td> Some text </td></tr></table></body></html>" ' SmtpMail.SmtpServer = "10.0.0.3" SmtpMail.Send(mailMsg) Response.Write ("Your message has been sent") Catch ex As Exception Response.Write(ex.Message) End Try
++ Thanks & Regards, Deepika
protected void btnsubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { string StrMailBody = "Name: " + txtname.Text.ToString().Trim() + ", Contact No.: " + txtcont.Text.ToString().Trim(); SmtpClient client = new SmtpClient(); client.DeliveryMethod = SmtpDeliveryMethod.Network; client.EnableSsl = true; client.Host = "smtp.gmail.com"; client.Port = 587; // setup Smtp authentication System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("emailid", "pwd"); client.UseDefaultCredentials = false; client.Credentials = credentials; MailMessage msg = new MailMessage(); msg.From = new MailAddress("emailid"); msg.To.Add(new MailAddress("receiver emaid id ")); //msg.CC.Add(new MailAddress("email")); msg.Bcc.Add(new MailAddress("sandeepchrs@yahoo.com")); msg.Subject = "SMWS - Contact Us"; msg.IsBodyHtml = true; msg.Body = string.Format("<html><head></head><body><b>Name: </b>" + txtname.Text.ToString().Trim() + "<b>Contact us: </b>" + txtcont.Text.ToString().Trim() + "</body>"); try { client.Send(msg); //lblMsg.Text = "Your message has been successfully sent."; } catch (Exception ex) { //lblMsg.ForeColor = Color.Red; //lblMsg.Text = "Error occured while sending your message." + ex.Message; } } }
ER sandeep chourasia sandeepchrs@yahoo.com (on facebook) http://www.aspnetcodes.com/
Login to post response