Thanks Aboredman. Very swift response. I'm sure your response is excellent but it's over my head. I've done most of my site building in FP and expression web 1 & 2 and although i do have limited experience of vb I've not really used it in any web projects.
As I've used the asp.net membership tools in Expression web 2 (although I did use VS2008 to add the required DB) so I'm unsure of the following:
Whether i'm using SQL express 2005
There is a stored procedure in VS 2008 for aspnet_Membership_Getallus
What a table adapter is and where the wizard is
What creating an instance of the table adapter means
What I'm after is an admin page that will collect all the email addresses behind the scenes, allow me to input a subect, body attach a file and then send. I can do the email form part but I have no idea on the code needed to achive getting the email addresses and then building the bcc list
Main Topics
Browse All Topics





by: aboredmanPosted on 2009-06-05 at 07:04:16ID: 24556510
I will assume that you are not using 3tiers type of application but accessing directly to your DB from your web application code.
om/
I will also assume that you are using SQL express 2005.
What I would suggest is create a stored procedure that return a data table that contains a list of users with their email address.
Something like SELECT USERNAME, EMAIL_ADRESS FROM MY_TABLE WHERE USER_ACTIVE = TRUE
Then create table adapter in a dataset in your asp.net solution using the wizard. Select the datasource as your stored procedure.
In a class or directly in your page code create an instance of the table adapter and fill a new datatable using the getdata() method (or the name you gave to it).
then simply loop through your datatable (something like FOR each dr as datarow in dt) and send your email.
For a good reference about sending emails see: http://www.systemnetmail.c
Good luck