Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

emailing newsletter from XML recipient list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
slinky - 14 Feb 2008 05:54 GMT
Thanks in advance for for any clues: I have a website I'm building
using MS-Visual Web Developer Express (Asp.Net/VB.net). I'm tooling
it
to collect names and emails to send out our newsletter. I have
successfully setup an XML file with some sample names and emails. I
populated this through a well functioning .aspx page that writes to
the XML file and I have set up another .aspx page from which I can
view the collected persons. what I need is a way to send our
newsletter (which for the time being will be just some text in the
email body (but I'd like to do more). So I need to parse through the
XML list and send an email to each recipient. Any clues?

Here's my code for users entering their names and email addresses:

<script runat="server">
   Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
       If Not IsPostBack Then
           Using ds As New DataSet()
               ds.ReadXml(Server.MapPath("emailList.xml"))
               txtNewEvent.DataBind()
               txtDate.DataBind()
           End Using
       End If
   End Sub

   Private Sub btnSubmit_Click(ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles btnSubmit.Click
       Using ds As New DataSet()
           ds.ReadXml(Server.MapPath("emailList.xml"))
           Dim dr As DataRow = ds.Tables(0).NewRow()
           dr("emailAddress") = txtNewEvent.Text
           dr("name") = txtDate.Text
           ds.Tables(0).Rows.Add(dr)
           ds.WriteXml(Server.MapPath("emailList.xml"))
       End Using
   End Sub
</script>

Here's my code for viewing the list of emails:

<script runat="server">
   Private Function MakeDataView() as DataView
       Dim myDataSet As New DataSet()
       myDataSet.ReadXml(Server.MapPath("emailList.xml"))
       Dim view As DataView = New DataView(myDataSet.Tables(0))
       view.AllowDelete = False
       view.AllowEdit = False
       view.AllowNew = False
       view.Sort = "Name ASC"
       Return view
   End Function

   Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
       Dim view as DataView = MakeDataView()
       dgEmail.DataSource = view
       dgEmail.AllowSorting = True
       dgEmail.DataBind()
   End Sub
</script>

Thanks!!!
siccolo - 14 Feb 2008 13:31 GMT
hmm...you can use SQL Server to retrieve data from XML file and send
emails...
slinky - 14 Feb 2008 13:56 GMT
Ooops... my web hosting provider does not support SQLServer and I've
had a dickens of a time installing it and finding workarounds. I have
an Access database running on my site... can that be used to retrieve
XML data? I'm a newbie to sending out bulk emails through VB.net/
ASP.net so I don't know where to start.

I did find this block of code that I may be able to learn something:

<%@ Page Explicit="True" Language="VB" Debug="True" %>
<html>
<body>
<%
   Dim EMailFrom As String = "bill@edgequest.com"
   Dim EMailTo As String = "billhatfield@edgequest.com"
   Dim EMailSubject As String = "Important message!"
   Dim EMailBody As String = "Thanks for reading this" & _
      "message but I must admit, I lied. There's " & _
      "nothing important about this message at all."

   Dim MySmtpClient As New _
      System.Net.Mail.SmtpClient("localhost")

   MySmtpClient.Send(EMailFrom, EMailTo, _
       EMailSubject, EMailBody)
%>
</body>
</html>

> hmm...you can use SQL Server to retrieve data from XML file and send
> emails...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.