Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Protected Sub SendMailBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendMailBtn.Click
- Dim dt As DataTable = DirectCast((RadioButtonList1.SelectedValue.Select(DataSourceSelectArguments.Empty)), DataView).Table
- For Each dr As DataRow In dt.Rows
- Dim emailsender As String = "noreply@mymailhost.com"
- Dim emailRecipient As String = dr("Email").ToString()
- Dim UserName As String = "Dear " + dr("UserName").ToString() + ",<br/><br/>"
- Dim mm As New MailMessage(emailsender, emailRecipient)
- mm.Subject = mailSubject.Text
- mm.Body = UserName + mailBody.Text
- mailBody.Text = Replace(mailBody.Text, vbCrLf, "<br />")
- mm.IsBodyHtml = True
- Dim smtp As New SmtpClient()
- smtp.Send(mm)
- Next
- Response.Redirect("/MailSuccess.aspx")
- End Sub
- <asp:RadioButtonList ID="RadioButtonList1" runat="server">
- <asp:ListItem Value="sqldatasource1">Option 1</asp:ListItem>
- <asp:ListItem Value="sqldatasource2">Option 2</asp:ListItem>
- <asp:ListItem Value="sqldatasource3">Option 3</asp:ListItem>
- </asp:RadioButtonList>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement