2 Replies - 269 Views - Last Post: 30 September 2012 - 12:41 AM Rate Topic: -----

#1 jhekz41  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-September 12

How to Select All email from users database and then send ALL an email

Posted 30 September 2012 - 12:06 AM

Im new here in this forum and in visual basic programming. im using microsoft visual studio- VB.net

here's my code:

Try
cnn.Open()
' query the email address of the students in tbl_students'
Dim sQuery As String = "Select std_eadd from tbl_students"

Dim cmdCommand As New MySqlClient.MySqlCommand(sQuery, cnn)
cmdCommand.ExecuteNonQuery()

Dim dbaseStd As New DataTable("Result")
Dim sqlAdapter As New MySqlClient.MySqlDataAdapter()
sqlAdapter.SelectCommand = cmdCommand
sqlAdapter.Fill(dbaseStd)

dim recipient as string
recipient = ?? The selected std_eadd query?

'code for sending mail'
SmtpServer.Credentials = New Net.NetworkCredential("jhekuzai@gmail.com", "********")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
SmtpServer.EnableSsl = True
mail.To.Add(recipient)
mail.From = New MailAddress("DSSniRobManosca@yahoo.com")
mail.Subject = (txtSubject.Text)
mail.Body = (rtxtMsg.Text)
SmtpServer.Send(mail)


Catch ex As MySqlClient.MySqlException
MsgBox(ex.Message.ToString)
Finally
cnn.Close()
txtSubject.Clear()
rtxtMsg.Clear()


End Try



*Pls Help me :| for my final defense in school...

Is This A Good Question/Topic? 0
  • +

Replies To: How to Select All email from users database and then send ALL an email

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5674
  • View blog
  • Posts: 12,189
  • Joined: 02-June 10

Re: How to Select All email from users database and then send ALL an email

Posted 30 September 2012 - 12:19 AM

You claim this is for school... but by that title it sounds exactly like a spam bot/virus. We're not going to help you build a spam bot that grabs all the email addresses in a user's address list and send them mail/spam.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9570
  • View blog
  • Posts: 36,240
  • Joined: 12-June 08

Re: How to Select All email from users database and then send ALL an email

Posted 30 September 2012 - 12:41 AM

Agreed. I am going to close this. OP - if you wish to convince me otherwise shoot me a pm.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1