This is a discussion on How to send HTML Emails? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi friends, How to send Emails in ASP.Net? I need to send html file in that mail....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Quote:
You can send html formatted mail using MailFormat.Html. Be sure the BodyFormat property is set to MailFormat.Html and then set the Body property like in the following example: Code: Msg.Body = "<HTML><HEAD><TITLE>Hi Leo!</TITLE></HEAD><BODY><h3>Hi buddy</h3><p><font face='Verdana' size='2'>Testing</font></p></BODY></HTML>";
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! Last edited by S.Vinothkumar : 09-21-2007 at 07:36 AM. |
| |||
| Use the following code buddy.. Code: Imports System.Web.Mail
'namespace to be imported
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
Dim mailMessage As New MailMessage()
'creating an instance of the MailMessage class
mailMessage.From = "test@test.com"
'senders email address
mailMessage.To = "demo@mytest.com;test@base.com;abc@abc.com"
'multiple recipient's
mailMessage.Cc = "nama@mycom.com"
'email address of the Cc recipient
mailMessage.Bcc = "bccCopy@test.com"
'email address of the Bcc recipient
mailMessage.Subject = "Hello"
'subject of the email message
mailMessage.BodyFormat = MailFormat.HTML
'HTML message format
mailMessage.Body = "<html><body><b><u>" & "This tutorial is sending an HTML email_
with an ASP.NET app." & "</u></b></body></html>"
'message body, html message
Dim Attach As MailAttachment = New MailAttachment("C:\images\sun.gif")
mailMessage.Attachments.Add(Attach)
'adding an attachment
mailMessage.Priority = MailPriority.Normal
'email priority. Can be low, normal or high
SmtpMail.SmtpServer = "mail.yourserver.com"
'mail server used to send this email. modify this line based on your mail server
SmtpMail.Send(mailMessage)
'using the static method "Send" of the SmtpMail class to send the mail
Response.Write("Mail sent")
'message stating the mail is sent
End Sub ![]()
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| <% @Page Language="C#" %> <% @Import Namespace="System.Web.Mail" %> <% MailMessage msgMail = new MailMessage(); msgMail.To = "christophw@sleeper.Dev.AlfaSierraPapa.Com"; msgMail.Cc = "webmaster@sleeper.Dev.AlfaSierraPapa.Com"; msgMail.From = "webmaster@aspheute.com"; msgMail.Subject = "Hi Chris, another mail"; msgMail.BodyFormat = MailFormat.Html; string strBody = "<html><body><b>Hello World</b>" + " <font color=\"red\">ASP.NET</font></body></html>"; msgMail.Body = strBody; SmtpMail.Send(msgMail); Response.Write("Email was queued to disk"); %> Last edited by GDevakii : 10-07-2007 at 10:44 PM. |
| |||
| SmtpClient smtpClient = new SmtpClient("IPaddress"); MailMessage message = new MailMessage("sender@sender.com", "rcpt@recipient.com"); message.Subject = "Subject Email"; message.Body = "<H2>Testing HTML Email</H2>"; message.IsBodyHtml = true; smtpClient.Credentials = new NetworkCredentials("sender@sender.com","password") ; smtpClient.Send(message); |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Do we have facilities to send SMS thru asp? | kingmaker | Other Web Programming Languages | 3 | 07-17-2008 11:58 AM |
| How to Send mail using dot net ...? | a.deeban | ASP and ASP.NET Programming | 9 | 01-17-2008 09:20 PM |
| send the sms using SMS/MMS Gateway in php | varghese | PHP Programming | 1 | 09-18-2007 08:32 AM |
| need help !! problem with emails | LEO | Server Management | 0 | 09-07-2007 12:09 AM |
| Yahoo, AOL plan to charge users for sending 'direct' emails | senthilkannan | Yahoo | 0 | 07-30-2007 03:27 AM |