Question Problem in sending email to the list of people

angila85

New member
Joined
Nov 16, 2010
Messages
2
Programming Experience
1-3
Hi,

I have page where I have to send an email to the list of people (fetch from database) when I click a Button. Problem is: when I send an email, It does not deliver to everyone in the list. If I have 50 people in the list, it is only delivering to the 35-40 people. I don't understand what can be the problem.

Here is my code:


Sub btnAddSignal_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSignal.Click
Dim SB1 as New StringBuilder()
Dim SW1 as New StringWriter(SB1)
Dim htmlTW1 as New HtmlTextWriter(SW1)
dgrdIntraDaily.RenderControl(htmlTW1)


Dim SB2 as New StringBuilder()
Dim SW2 as New StringWriter(SB2)
Dim htmlTW2 as New HtmlTextWriter(SW2)
GridView1.RenderControl(htmlTW2)

Dim SB3 as New StringBuilder()
Dim SW3 as New StringWriter(SB3)
Dim htmlTW3 as New HtmlTextWriter(SW3)
Comments.RenderControl(htmlTW3)



Dim dataGridHTML1 as String = SB1.ToString()
Dim dataGridHTML2 as String = SB2.ToString()
Dim textHTML as String = SB3.ToString()


Dim u As MembershipUser
'get users in role
Dim UserName As String
Dim from As String = "website@forexatom.com"

For Each UserName In Roles.GetUsersInRole("PayPalVerified")
u = Membership.GetUser(UserName)
' Dim msg As New MailMessage("Website@forexatom.com", u.Email)
Dim msg As New MailMessage
msg.From = New MailAddress(from, "ForexAtom")
msg.To.Add(u.Email)





'add fields
msg.Subject = "ForexAtom.com 24-hour Update"
msg.IsBodyHtml = True
' msg.BodyFormat = MailFormat.Html
msg.Body = "<table width='100%' border='0' cellspacing='0' cellpadding='1'><tr><td>Please Log on to members section of website if you do not receive an email by 1.05 am/pm New Zealand Time – All signals are posted/sent at 1.00 am/pm G.M.T but via email that can extend by up to 25 minutes.<td></tr> </table>" & "<br /></ br> <table><tr><td><strong>Comments: </strong></td><td bgcolor='#FFFF66' style='font:large bold;color:#663333'>" & textHTML & "</td></tr></table><br /></ br>" & "<table width='100%' border='0' cellspacing='0' cellpadding='1'> <tr> <td width='42%' rowspan='2' nowrap bgcolor='#345986'> <font face='Trebuchet Ms' color='#FFFFFF' size='4'>Current Active Signals</font></td> <td width='58%'> </td> </tr> <tr> <td bgcolor='#345986'><img src='http://www.forexatom.com/images/spacer.gif' width='1' height='1' alt='' /></td> </tr> </table>" & dataGridHTML1 & "<br /></ br>" & "<table width='100%' border='0' cellspacing='0' cellpadding='1'><tr><td>Our Signal Service represents 10% - 15% of the trades we place on our Managed Accounts. We finished 2010 at 44.92% Gross return (2009 - 52.72%).</td></tr></table>" & "<br /></ br>" & "<table width='100%' border='0' cellspacing='0' cellpadding='1'><tr><td>Contact <a href=mailto:shane@forexatom.com>Shane</a> to find out more</td></tr></table>" & "<br /></ br>" & "<table width='100%' border='0' cellspacing='0' cellpadding='1'> <tr> <td width='42%' rowspan='2' nowrap bgcolor='#345986'> <font face='Trebuchet Ms' color='#FFFFFF' size='4'>Previous 10 Closed Signals</font></td> <td width='58%'> </td> </tr> <tr> <td bgcolor='#345986'><img src='http://www.forexatom.com/images/spacer.gif' width='1' height='1' alt='' /></td> </tr></table>" & dataGridHTML2 & "<br /></ br>" & "<table width='100%' border='0' cellspacing='0' cellpadding='1'><tr><td><b>Risk Warning/ Disclaimer:</b> Trading foreign exchange carries a high level of risk. Before deciding to trade foreign exchange you should carefully consider your level of experience and risk appetite. The possibility exists that you could sustain a loss of some or all of your deposited funds and therefore you should not speculate with capital that you cannot affort to lose. If you have any doubts you should seek the advise of a independent advisor.</td></tr></table>"


Dim smtp As New SmtpClient
smtp.Host = "mail.forexatom.com"
smtp.Credentials = New System.Net.NetworkCredential("website@forexatom.com", "12webforex")
smtp.ServicePoint.MaxIdleTime = 5
smtp.Send(msg)
msg.Dispose()

' Response.Write("<i>Email sent to " & u.Email & "!</i><br />")
Next


'pnlSuccess.Visible = True
'pnlDispatch.Visible = False
End Sub



Please help me to resolve the problem.

Thanks
Yasmeen
 
Back
Top