Help!! email newsletter from XML file

Discussion in 'Javascript' started by slinky, Feb 14, 2008.

  1. slinky

    slinky Guest

    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'm hoping to find some Javascript that will iterate through my XML
    file and send abtout 100 emails out automatically to those wanting my
    newsletter. I've tried to do this in ASP.net/VB.net but am stumped so
    I thought I'd look at the Javascript possibilities.

    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 vb.net/asp.net 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>
    slinky, Feb 14, 2008
    #1
    1. Advertising

  2. slinky wrote:

    > I'm hoping to find some Javascript that will iterate through my XML
    > file and send abtout 100 emails out automatically to those wanting my
    > newsletter. I've tried to do this in ASP.net/VB.net but am stumped so
    > I thought I'd look at the Javascript possibilities.


    Client-site javascript could parse the XML-file, but cannot
    automatically send emails.

    The usual way is to make a server-side application like this:

    1. Read XML-file into memory
    2. Parse the DOM or tie to variables
    3. Loop for every entry
    4. Send out the mail for each entry in the loop
    5. Print report to screen

    Hope this helps,

    --
    Bart
    Bart Van der Donck, Feb 15, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,173
  2. AF
    Replies:
    1
    Views:
    394
    Jeff Thies
    May 6, 2004
  3. Chuck

    Creating an email newsletter

    Chuck, Aug 5, 2004, in forum: HTML
    Replies:
    3
    Views:
    318
    Chuck
    Aug 5, 2004
  4. johnny15
    Replies:
    3
    Views:
    1,113
    Toby A Inkster
    May 18, 2007
  5. slinky
    Replies:
    2
    Views:
    355
    slinky
    Feb 14, 2008
Loading...

Share This Page