Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send out mass email

Status
Not open for further replies.

taree

Technical User
May 31, 2008
316
US
Hi all,

I need your help how I could send out mass email form the database.I have a page set up to collect email address and my question to you is how can I send out a mass email when I have an update. I have the email address in my access database.

thank you
 
Thank you jbenson001 for your reply. I did try to put together this code. I have two question when I send out a mass email I would like to use bcc that way no one will know who else received email. From is the email from sender and To: what do i put here?

Code:
Imports System.Net.Mail
Partial Class emailT
    Inherits System.Web.UI.Page
    Protected Sub SendEmail()

        Dim strEmailsCollectionCount As String() = GetEmailAddresses()
        Dim i As Integer
        Dim strEmailCollections As New StringBuilder()

        For i = 0 To strEmailsCollectionCount.Length - 1
            If i <> 0 Then
                strEmailCollections.Append(";")
            End If

            Dim test As String = strEmailCollections.Append(strEmailsCollectionCount(i)).ToString
        Next
        Dim mail As New MailMessage
        mail.Bcc = strEmailCollections.ToString()

    End Sub

    Protected Function GetEmailAddresses() As String()
        Dim strEmailArray(2) As String

        strEmailArray(0) = "Myemail1@address.com"
        strEmailArray(1) = "Myemail2@address.com"
        strEmailArray(2) = "Myemail3@address.com"

        Return strEmailArray

    End Function

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        SendEmail()
    End Sub
End Class
 
Code:
changed to this still getting: 'The specified string is not in the form required for an e-mail address. any clue?

mail.Bcc.Add(strEmailCollections.ToString)
 
How to do you change the return value to array list.

Code:
 Protected Function GetEmailAddresses() As ArrayList

        Dim strTMConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\DataBase\emaillist.mdb") & ";"
        Dim MyTMConn As New OleDbConnection(strTMConn)
        Dim strSQL As String = "SELECT email from tbEmail"
        Dim cmdTM As OleDbCommand = New OleDbCommand
        cmdTM.Connection = MyTMConn
        cmdTM.CommandType = CommandType.Text
        cmdTM.CommandText = strSQL
        Dim adTM As New OleDbDataAdapter(cmdTM)
        Dim bldTM As OleDbCommandBuilder = New OleDbCommandBuilder(adTM)
        Dim dsTM As New DataSet
        adTM.Fill(dsTM, "EmailList")
        Return dsTM


    End Function
 
You'll have to loop throught the rows in the datatable and add the values you want to an arraylist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top