10 Replies - 655 Views - Last Post: 19 April 2011 - 09:47 PM Rate Topic: -----

#1 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Problem in sending email to list of people

Posted 17 April 2011 - 03:54 PM

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'>&nbsp;<font face='Trebuchet Ms' color='#FFFFFF' size='4'>Current Active Signals</font></td>	  <td width='58%'>&nbsp;</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'>&nbsp;<font face='Trebuchet Ms' color='#FFFFFF' size='4'>Previous 10 Closed Signals</font></td>    <td width='58%'>&nbsp;</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

This post has been edited by macosxnerd101: 17 April 2011 - 04:36 PM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Problem in sending email to list of people

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1066
  • View blog
  • Posts: 4,173
  • Joined: 02-July 08

Re: Problem in sending email to list of people

Posted 17 April 2011 - 06:48 PM

Have you debugged the code and see where it goes, get the membership count?
Was This Post Helpful? 0
  • +
  • -

#3 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Re: Problem in sending email to list of people

Posted 17 April 2011 - 06:58 PM

Debugging is fine, it is not showing any error while executing. It used to work very well earlier but as my list is increasing, it start creating this problem. :(

View Posthawkvalley1, on 17 April 2011 - 06:48 PM, said:

Have you debugged the code and see where it goes, get the membership count?

Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1066
  • View blog
  • Posts: 4,173
  • Joined: 02-July 08

Re: Problem in sending email to list of people

Posted 17 April 2011 - 07:08 PM

I wonder if there is a bottleneck with a bigger list?
Was This Post Helpful? 0
  • +
  • -

#5 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Re: Problem in sending email to list of people

Posted 17 April 2011 - 07:18 PM

So if there is an issue with a big list, how can i resolve it? because the problem is when i click the button it goes into long processing and sometime never stops.

I try to put my email address instead to that list to know how many times i will get an email and I got 38 times but my list is more than 100 now.

Please help.

Thanks

View Posthawkvalley1, on 17 April 2011 - 07:08 PM, said:

I wonder if there is a bottleneck with a bigger list?

Was This Post Helpful? 0
  • +
  • -

#6 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1066
  • View blog
  • Posts: 4,173
  • Joined: 02-July 08

Re: Problem in sending email to list of people

Posted 17 April 2011 - 07:39 PM

Well have you tried adding all the recipients to the msg.To.Add and then send one time?
Was This Post Helpful? 0
  • +
  • -

#7 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Re: Problem in sending email to list of people

Posted 17 April 2011 - 08:26 PM

No, Actually they are our business clients so I don't want them to get unwanted emails

View Posthawkvalley1, on 17 April 2011 - 07:39 PM, said:

Well have you tried adding all the recipients to the msg.To.Add and then send one time?


usernames are arranged alphabetically, so people who are not getting emails are those whose username starts with some last alphabets..like t,u z etc

View Postyasmeen1, on 17 April 2011 - 08:21 PM, said:

No, Actually they are our business clients so I don't want them to get unwanted emails

View Posthawkvalley1, on 17 April 2011 - 07:39 PM, said:

Well have you tried adding all the recipients to the msg.To.Add and then send one time?

Was This Post Helpful? 0
  • +
  • -

#8 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Re: Problem in sending email to list of people

Posted 19 April 2011 - 03:03 PM

Hi, I tried it by adding some recipients to the msg.To.Add, but it worked for a while then crashed.

View Postyasmeen1, on 17 April 2011 - 08:26 PM, said:

No, Actually they are our business clients so I don't want them to get unwanted emails

View Posthawkvalley1, on 17 April 2011 - 07:39 PM, said:

Well have you tried adding all the recipients to the msg.To.Add and then send one time?


usernames are arranged alphabetically, so people who are not getting emails are those whose username starts with some last alphabets..like t,u z etc

View Postyasmeen1, on 17 April 2011 - 08:21 PM, said:

No, Actually they are our business clients so I don't want them to get unwanted emails

View Posthawkvalley1, on 17 April 2011 - 07:39 PM, said:

Well have you tried adding all the recipients to the msg.To.Add and then send one time?

Was This Post Helpful? 0
  • +
  • -

#9 ericzmeh  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 56
  • Joined: 13-September 09

Re: Problem in sending email to list of people

Posted 19 April 2011 - 05:19 PM

Is it possible the smtp remote host is not responding, at least to the ones who do not receive the e-mails?
Was This Post Helpful? 0
  • +
  • -

#10 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Re: Problem in sending email to list of people

Posted 19 April 2011 - 06:57 PM

When you say smtp remote host is not responding, what that mean? Are you saying that webhost not working properly?

View Postericzmeh, on 19 April 2011 - 05:19 PM, said:

Is it possible the smtp remote host is not responding, at least to the ones who do not receive the e-mails?

Was This Post Helpful? 0
  • +
  • -

#11 yasmeen1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-April 11

Re: Problem in sending email to list of people

Posted 19 April 2011 - 09:47 PM

Here is my web.config:

<system.net>
<mailSettings>
<smtp from="website@forexatom.com">
<network host="smtp.forexatom.com" password="abc" userName="website@forexatom.com" />
</smtp>
</mailSettings>
</system.net>

Am I doing anything wrong in that?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1