IT Community - Software Programming, Web Development and Technical Support

How to send HTML Emails?

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....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-21-2007, 05:58 AM
leoraja8 leoraja8 is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 194
leoraja8 is on a distinguished road
Question How to send HTML Emails?

Hi friends,

How to send Emails in ASP.Net?

I need to send html file in that mail.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-21-2007, 06:43 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Cool Re: How to send HTML Emails?

Quote:
Originally Posted by leoraja8 View Post
Hi friends,

How to send Emails in ASP.Net?

I need to send html file in that mail.
Ya buddy,

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-21-2007, 08:47 AM
jeyaprakash.c jeyaprakash.c is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 228
jeyaprakash.c is on a distinguished road
Exclamation Re: How to send HTML Emails?

Can u explain with sample vinoth?
__________________
thanx n regards
jeyaprakash.c
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-22-2007, 02:06 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: How to send HTML Emails?

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
Attachment sending also in that coding.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-03-2007, 09:53 AM
seetha seetha is offline
D-Web Trainee
 
Join Date: Oct 2007
Posts: 7
seetha is on a distinguished road
Default Re: How to send HTML Emails?

hi
this firs time , i am joining this site....
i do not know how to post question ,,,
sorry for disturb...
i do not have way to post
plz help me.
i can not reply ,,
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-07-2007, 10:41 PM
GDevakii GDevakii is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 138
GDevakii is on a distinguished road
Default Re: How to send HTML Emails?

<% @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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-01-2007, 10:44 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Smile Re: How to send HTML Emails?

SmtpClient smtpClient = new SmtpClient("IPaddress");
MailMessage message = new MailMessage("sender@sender.com", "rcpt@recipient.com");
message.Subject = "Subject Email";
message.Body = "&lt;H2>Testing HTML Email</H2>";
message.IsBodyHtml = true;
smtpClient.Credentials = new NetworkCredentials("sender@sender.com","password") ;
smtpClient.Send(message);
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 06:33 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0