New Zealand's new Copyright Law presumes 'Guilt Upon Accusation' and will Cut Off Internet Connections without a trial. CreativeFreedom.org.nz 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(

"RequestedBy_DropDownList")

   IssueID_Label = .FindControl("JobID_Label")

End With


'Set the properties

objMM.To.Add(Requestor_DropDownList.SelectedValue + "@telecom.co.nz")

objMM.From = New MailAddress("est@telecom.co.nz")


'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()

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 = "WNEXBE01.telecom.tcnz.net"

objSC.Send(objMM)



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








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