.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Email template from HTML

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net

 Hello All,

is there a way to use a HTML template for a mail function.

a users fills in some info, than a email template (html file) is filled with parameters and than send to the receiving person.


Any help would be aprreciated.







View Complete Post

More Related Resource Links

Send HTML email with banner inside


Hi all,

I want to send html emails with one promo-banner inside. Have a look at my code... I try but with no success.


            Dim strFrom, strTo, strSubject, strBody As String
            Dim myMessage As MailMessage
            Dim mySmtpClient As SmtpClient
            strFrom = "SENDER<test@example.com>"
            strTo = Session("eemaill")
            strSubject = "HELLO THERE!"
            strBody = "HELLO THIS IS MY MSG<br />" + _
            " <script type='text/javascript'> var ai = 899; var rc = 40; var rt= 2; var rc_width = 724; var rc_height = 90; </script>" + _
            " <script type='text/javascript' src='http://assets.example.com/s/ads.js'></script><br /><br />" + _
            "<b>THANK YOU</b>"
            myMessage = New MailMessage(strFrom, strTo, strSubject, strBody)
            myMessage.IsBodyHtml = True
            mySmtpClient = New SmtpClient("mail.example.com")




Thank you

System.Net.Mail HTML Template Problem


What do I need here ?????? To make this work??

Dim MassMail As New MailMessage()

        Dim Template As ??????????????

        MassMail.To.Add(New MailAddress(TextBox_massemailto.Text))
        MassMail.From = New MailAddress("You@me.com")

        ' MassMail.CC.Add()
        MassMail.Subject = TextBox_massemailsubject.Text
        MassMail.Body = TextBox_massemailBody.Text
        ' MassMail.Body = Template.BodyFileName = "EmailTemplates/BusinessAdBrochure.htm"
        MassMail.Priority = MailPriority.High

        Dim smtpclient As New SmtpClient("relay-hosting.secureserver.net")
        smtpclient.Credentials = New System.Net.NetworkCredential(""You@me.com"", "pasword")
        smtpclient.Port = 25
        smtpclient.EnableSsl = False

putting carriage return/line feed in non-HTML email text

Using vb.net/asp.net 2005I am trying to create a string message for an email that I am sending out from my asp.net page like so: For Each dr In dtDataTable.Rows strMessage = strMessage & vbCrLf & vbCrLf & Environment.NewLine & dr.Item("UserName") & Environment.NewLine Next so I am looping through a datatable and getting each name from each row, that is working well but when I get the email it appears in my inbox with all the names mashed together, you see I am trying both vbcrlf and newline but looks like neither is workingdoes anyone know what I'm doing wrong?

Custom Email Alert template creating links to DispForm.aspx

I have a requirement to customise the alert template for a standard blog post list. To do this I: 1. Created a copy of alertstemplate.xml 2. Copied the genericList alert template node and customised 3. Registered the new template file against the site collection, iisreset and finally assigned the new Alert template to the list, when alerts are created the custom template is emailed. The problem now arises that the 'View <Post Title>' in the toolbar section now creates a hyperlink to http..../Lists/Posts/Dispform.aspx?ID=xx rather than post.aspx. I have checked using sharepoint designer that the list supporting files has the correct display item form of Lists/Posts/Post.aspx. Additionally if I reset the alert template for the list back to use the Generic list template the same problem still occurs so this leads me to believe it is not the customisations that are the problem. Code used to assign the alert template to the Posts list: var ats = new SPAlertTemplateCollection((SPWebService) site.WebApplication.Parent); var newTemplate = ats[alertName]; if (newTemplate == null) { // We did not find the specified Template. throw new Exception("Failed to find template SPAlertTemplateType.NewsPost in the template collection."); } list.AlertTemplate = newTemplate; list.Update(); Any assistance will be most welcome, thanks in advance. Alan

sending muliple html pages in single email


want to send muliple html pages in a email in vb.net

Sending an Email in HTMl


Hi all

In the following HTML I have 3 input boxes Name,Email,Subject and a textbox for the message.

Now how can I send the text entered to a specified email address when the user sellects the send button.

I would realy apreciated if you know of any document that would explain this, I tried googleing it I found lots but it wasn't well explained.



<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Contacts.aspx.vb" Inherits="Contacts" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div class="contactdiv">

<div id="divlblname">
<asp:Label ID="lblname" runat="server">Name</asp:Label>
<div id="divtxtname">
    <input id="txtname"  size="35px" type="text" /><br />

<div id="divlblmail">
    <asp:Label id="lblemail" runat="server">Email</asp:Label

Editor Custom Button with template HTML



How can I add button to the toolbar that will add a small html template text to content?

For example, when I click on that button, I want to "<table><tr><td><b>Hello world</b></td></tr></table>" be added to the content.

Thanks in advance,


HTML template for mail


Hello all,

although the subject is a HTML page, I'm not sure if this is the right forum.

some time ago i posted a question about the creation of a HTML template for use in a Email in a ASP.net application.

I've got this working now, now follow's the next challenge.  a users chooses a radiobutton item (databond from a database), up on the choice he makes a particular HTML template should be used for the mail. There can be a difference in the ammount of variables in a template, for instance one templates hold's just as a variable a  name of a person, while a other template also uses name, adres and telephonennumber as a value.  What should be the most efficient though flexible way to be able to  fill and enummerate all the variables whether it's just one or more, I want to write just one function for all templates sending, but I don't know how this can be accomplisshed. Is it a option to write the properties (ammount of variables) in the database also, or are there other ways?


I hope someone can and will help me.



Take care,



HTML Email & Gridviews


I have a timesheet app on our intranet where users enter the time for projects worked on in a gridview.  The gridview is included in an html email which gets sent to the users' lead.  If the lead approves, a copy should get shot to the appropriate staff.  I can not figure out how to call the gridview in the lead's email.  Any help is greatly appreciated.  See sample code below:

            .From = New MailAddress(Session("uEMail"), Session("uName"))
            .IsBodyHtml = True
            .Subject = "Timesheet for week ending (" & txtPeriod.Text & ") from " & Session("uName")
            .Body = "<html><body>"
            .Body = "<table valign=top border=0 width=500px>"
            .Body = .Body & "<tr><td bgcolor=#30297A colspan = ""2"" align = ""left"" valign = ""middle""><font color=#F4D331 size=6px><b>" & strForm & " for " & txtPeriod.Text & "</b></font></td></tr>"
            .Body = .Body & "<tr><td width=40%>Submitted By: </td><td width=60%>" & txtSubmittedBy.Text & "</td>

Custom Email Alerts using Helpdesk Template in MOSS 2007

Hi All,

I recently installed the Helpdesk template on our SharePoint 2007 Server but I want to find out how to set up alerts so that when a job request has been assigned to person X an email will automatically be sent to that person. Currently you can custimise the Service Request list so that whenever changes are made to it an email can be sent to a designated person, however, what we require is an email being sent to the service request owner.

I presume this will require custom coding but is there third party plug-ins which provide this functionality? As i have never programmed for MOSS i was wondering how much of a task is it to provide this functionality?

Any help would be greatly appreciated,


Incoming email settings on Application Template: Help Desk

I've installed the Help Desk application template and created a new
site based on it.  All looks great except that I can't figure out how
to set the site to receive incoming emails which would in turn create
a new service request.  Hopefully it's there and I'm just not seeing

TIA for your help.

Retreive A Label From Gridview Then Email It In HTML Form


I have a gridview with a button on the end of each row... When the button is clicked I need to access information on that specific row then send the information via email... So for example 1 row will have a binded label firstname "Chris", when the button is ticked for that row it needs to send the value "Chris" in an email... Im just wondering how this can be done?

Firstname label in gridview:

            <asp:Label ID="Firstnamelbl" runat="server" Text='<%# Eval("Firstname") %>'></asp:Label>

Button at the end of each row:

                    <asp:Button ID="Button1" Runat="server" Text="Send" OnClientClick="Button1_Click" />

Workflow Email - HTML customization


I'm trying to customize a simple workflow email that's pulling data from an Infopath form with a repeating table. In order for the data to be readable, it needs to be put in a table with columns and rows. I've tried to use HTML code to achieve this in SharePoint Designer 2010 but when the email goes out, it's just the code. I'm not familiar with HTML so I don't know what I'm doing wrong. Here's the code that I've pasted into the body of the "Define Email Message" window (except where it says "lookup" I actually added fields from the list as a "String"...not sure why it won't let me copy and paste them):

<h3>Date:</h3><h3>Clinician:</h3><table border="2"><tr><td>Location</td><td>Species</td><td>LC#</td><td>Comment</td><td>Vet</td></tr><tr><td>lookup</td><td>lookup</td><td>lookup</td><td>lookup</td><td>lookup</td></tr></table><h3>Upcoming Procedures</h3><table border="2"><tr><td>Species</td><td>Date</td><td>Description</td></tr><tr><td>lookup</td><td>lookup</td><td>lookup</td></tr></table><h3>Shipment Statu

Generating HTML email with mailto:


How do I generate an HTML email when the user clicks on a mailto: link?

Quota template email warning timer job


I enabled quota template on my sites. By design, it will send an email if somebody's mysite storage exceed the warning level of the quota template. I would like to know if the email is sent throught a daily timer job or if it is sent immediately when the storage reaches the warning level. The second question is: Is there a way to change the frequency of the warning email timer job?

Thank you in advanced.


SPD Workflow error only when I add HTML to the email


I've created similar emails before with sharepoint designer.

When I add HTML to format the email in my workflow, the workflow fails. but if I remove it, it completes without a problem.

ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend