New Zealand's new Copyright Law presumes 'Guilt Upon Accusation' and will Cut Off Internet Connections without a trial. is against this unjust law - help us

A Space for All Things .NET Related

Emailing from a Web Page

By James Hippolite, in , posted: 1-Aug-2008 16:25

Imports System.Net.Mail

'Create an instance of the MailMessage class

Dim objMM As New MailMessage()

Dim Requestor_DropDownList As DropDownList

Dim IssueID_Label As Label

With Issue_FormView   Requestor_DropDownList = .FindControl(


   IssueID_Label = .FindControl("JobID_Label")

End With

'Set the properties

objMM.To.Add(Requestor_DropDownList.SelectedValue + "")

objMM.From = New MailAddress("")

'Send the email in html format

objMM.IsBodyHtml = True

'Set the priority - options are High, Low, and Normal

objMM.Priority = MailPriority.Normal

'Set the subject

objMM.Subject = "Feedback"

'Set the body

Dim sb As New StringBuildersb.AppendLine("Kiaora " + Requestor_DropDownList.SelectedItem.Text)


sb.AppendLine("Your EST Issue is about to be closed.")sb.AppendLine(

"Please take 5 minutes to rate the service you have received the the Enterprise Service Team.")sb.AppendLine("Click into this link: http://wstProdIIS/EST/register/Issue.aspx?ID=" + IssueID_Label.Text)

objMM.Body = sb.ToString

'Now, to send the message, use the Send method of the SmtpClient class

Dim objSC = New SmtpClient

objSC.Host = ""


Other related posts:
Geek Post Monthly Newsletter Volume 2 Issue 6
Exam 70-300 Objective 3

Comment by chakkaradeep, on 1-Aug-2008 23:19

I think View needs to do only its job and pass on this to the Controller

Add a comment

Please note: comments that are inappropriate or promotional in nature will be deleted. E-mail addresses are not displayed, but you must enter a valid e-mail address to confirm your comments.

Are you a registered Geekzone user? Login to have the fields below automatically filled in for you and to enable links in comments. If you have (or qualify to have) a Geekzone Blog then your comment will be automatically confirmed and shown in this blog post.

Your name:

Your e-mail:

Your webpage:

JamesHip's profile

James Hippolite
New Zealand

Welcome to my technical blog. 

Here, I attempt to distill the Microsoft Certified Professional Developer knowledge I have accumulated since first qualifying MCP in 1996.  This blog started on 13 September 2007 as an off-shoot from my mixed up personal blog.  But it took a shot in the arm from Scott Hanselman's talk at TechEd New Zealand 08 "32 Ways To Make Your Blog Suck Less".