Sending email to all users in Membership database / all users by role.

I am trying to send emails to ALL users in the membership database.  Right now i am using this VB code to send an email in a web form.   Can anyone help me with the code to send this message in the web form to everyone in my membership database? Or to all users in the database assigned to a specific ROLE? (Actually that would be better).

 

Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendEmail.Click

Const ToAddress As String = "xxxj@xxxx.com,xxxx@xxxx.com,xxx@xxx.com"

Dim mm As New MailMessage(UsersEmail.Text, ToAddress)

mm.Subject = Subject.Text

mm.Body = Body.Text

mm.IsBodyHtml =

False

Dim smtp As New SmtpClient

smtp.Send(mm)

End Sub
0
cjsteury
5/13/2007 7:14:38 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

1 Replies
687 Views

Similar Articles

[PageSpeed] 45
Get it on Google Play
Get it on Apple App Store

Hi,

In fact, you can, at first, read from database and get all the addresses who you want to send mail to. Then just add them into "ToAddress" string.

Try to do that. If there is any other problem, please feel free to tell us.

Good luck!


Please give us feedback no matter whether you get your answer.
Please "mark as answer" if it's useful for you

Sincerely,
Jerome
0
Jerome
5/15/2007 6:10:42 AM
Reply:

Similar Artilces:

Problem : Get a list of user belonged to a role or to know if a user already has a role
What code can I write to know if a user belonged to a Role already ? and How can I get a list of a  user already in an existing role ? Please have a look at my code below : Protected Sub AddUsers_OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddUsersToRole.Click' I wanna add some code here to check if a user already belonged to a Role' Please insert your code here. Thanks a lot. ' A role must be selected If RolesListBox.SelectedItem Is Nothing Then Msg.Text = "Please select a role." Exit Sub End If ...

Comparing a user's name/email to membership user name/email
I want to compare a user's name and email that he/she has entered. If it is correct I want to send an email to the Admin to let them know that they need their password reset. I have the following but for some reason it keeps hitting the else statement: If txtUserName.Text.Length > 25 Then lblOutput.Text = "User's Name is too long!" ElseIf txtEmail.Text.Length > 45 Then lblOutput.Text = "User's Email is too long!" Else Dim strUserName As String = Trim(txtUserName.Text) Dim strEmail As String = Trim(txtEmail.Text) Dim mu As MembershipUser = M...

Users able to send email as different users
--____LPHMXLZMXOMRLFKSEJCW____ Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Internal users are able to use a email client such as Outlook or Eudora = and setup their reply address as something other than their email address, = or instance another internal users email address. Then they are able to = send email to other internal users as the other users. For example user A = sets up his reply email address to userB@xxx.com He then sends and email = to user C as requesting something. User C handles the request and replies = to the emai...

Each user as database user
Good day! I'm trying to implement my own MemebershipProvider. Problem is, that different users should be different database users. Not each user. Any idea, how to solve this? Because only way how to use some database user I know it is to change connection string...  Why dont you use Windows Authentication and let the Active Directory take care of your memberships. Is this an internal application?  It is not. I already wrote one post about it and I will tell it again. Application is based on classicla win application. The same database. Problem is, that usual dat...

Membership and Role Management
Hello, I've configured SQL server 2005 as my back-end data store via aspnet_regsql.exe. I presume it was succesvol. Creating users en roles programmatically is no problem. When I start the Web Site Administration Tool I can see the created users and roles. But when I want to show them by code I get an empty result. ... ... Roles.GetAllRoles()...... membership.GetAllUsers() The roleManager is enabled in web.config.<roleManager defaultProvider="SqlProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSS...

Sending email to a User Role
Hello, How's it going? I have an Error Log online that allows users to fill out a formview. I want to be able to send an email to members in a certain Role everytime an error has been logged. The email will include the Description from the error. I am able to do this for one user and manually input the email address however, I was curious if anyone knew how I could send the email to the entire Role? I am using the standard Users and Roles for ASP.NET pages. Thanks so much in advance. Dim i As Int16 Dim Users() As String Users = Roles.GetUsersInRole("Administrator")Dim ch...

Cannot open user default database. Login failed. Login failed for user 'DOMAIN\User'. (.Net SqlClient Data Provider)
Hi when i try and open a database in sql server management studio i get the error "Cannot open user default database. Login failed. Login failed for user 'DOMAIN\User'. (.Net SqlClient Data Provider)", what can i do to rectify this, i have googled around and still havent found no answers. Which authentication mode is your Sql Server configured - MixedMode, Windows Authentication or Sql Server Authentication? Please refer to http://msdn2.microsoft.com/en-us/library/ms366351.aspx and http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx    Ple...

How to get user name and user id from membership cookie
Hello,Is there any way to get the users logged users name and user id from the login cookie? I am using asp.net membership class. And also wanted to know if GetUserName() calls the database when ever it is called? thanks for any commentslistsergeant.com public static String GetUserName (HttpContext context) {    return context.User.Identity.Name;  } Try this K.Mohamed Faizal Solution Architecthttp://faizal-comeacross.blogspot.comPlease remember to click "Mark as Answer" on this post if it helped you Let say if you want to get Windows username then make sure...

Getting all Users from Membership by a specific Role
hi all, i am looking for a way to get all users that belong to a specific role in my membership system but am stuck. I have googled everywhere but cant seem to find any examples of getting a users role.  Can anyone provide me any examples.  basically i have two roles ADMIN and SALES.  I want to get a collection of all users in SALES so i can shoot them a mass email. thanks, mcm string[] users = Roles.GetUsersInRole(rolename);foreach (string user in users) { //Response.Write(user.ToString()); //do your emailing here }/GuruBhai SELECT aspnet_Membership.Email ...

how to get the email addr of the user by membership
Hello all, I just don't know how to get the user's email from membership? Or it is not the correct way to get the user email address. Can i retrive user's password, email and then update the user's detail, becuase initially i set passwordRetrival = false, for example:<membership> <providers><remove name="AspNetSqlMembershipProvider" /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral,  PublicKeyToken=b03f5f7f11d50a3a" c...

Groupwise user getting email from defunct user in different domain
I have a user getting someone else's email. It is kind of complicated so I will explain below. background: 1. groupwise 7.0.1 MTA/POA/GWIA in our (my) domain 2. There are 8 domains in our email system 3. our groupwise system was set up by us and we assisted in setting up the other domains, but we do not manage them. Some of the domains may still be less than version 7, I think a couple may be 5.5, one may still be 4.x. situation: My domain: abc.com, user RoseA@abc.com. This user alice rose left our company about 3 weeks ago. Apon this user leaving, we deleted her NDS accoun...

Get users email based on the role
Could anyone tell me how to get users email address based on the role assigned? Are there any properties/methods where I can directly get it like we have for Admin email (Portalsettings.email). Any help would be highly appreciated Thanks Mangala Bhat...

Web User Control and Membership
I have the next files: (default.aspx)  and (controls/test.ascx  controls/test.ascx.cs) I loading in the default.aspx my  web user control "test.ascx": Control cnt_menutop = Page.LoadControl("~/controls/test.ascx"); plh_menu.Controls.Add(cnt_menutop); I need in the  controls/test.ascx to calling User.Identity.Name but i got error. How to get the User.Identity.Name from "~/controls/test.ascx" ? I using Forms Auth.   Can you post the error?--------------------------------------------------------Don't fo...

can we default bcc to user B whenever user A sends emails out
can we default bcc to user B whenever user A sends emails out Andy Wong wrote: > can we default bcc to user B whenever user A sends emails out Not sure if this would work, but you could try it. Create a rule in User A's mailbox that says when a new item is sent, item type mail, forward the item to User A (you can't create a mail with only a BC or CC) and BC it to User B. But this would only work if every mail must be BC'ed to the same person. If you need different mails BC'ed to different people then I don't believe there's a way. -- Joe...

Web resources about - Sending email to all users in Membership database / all users by role. - asp.net.getting-started

Polish European Union membership referendum, 2003 - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Drivers of Facebook Shuttle Buses Eye Teamsters Membership
Facebook and several other tech companies in Silicon Valley provide shuttle buses to transport their employees, and according to The New York ...

NJ Membership (@NJMembership) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Membership Has Its Privileges
Right now, crossing one of the magical rep borders happens more or less unnoticed. People just gain the particular powers. Now, of course they ...

Membership Cards - a set on Flickr
... home Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Membership ...

Calgary Public Library: New Look. New Library. Free Membership. - YouTube
CREATING THE WORLD’S BEST PUBLIC LIBRARY: NEW LOOK. NEW LIBRARY. FREE MEMBERSHIP. For Immediate Release: In a bold move to become the world’s ...

The benefits of private club membership in the UAE
Lifestyle membership clubs can offer cardholders exclusive leisure discounts across the Emirates. But there can be a big catch - you need to ...

New Brisbane Broncos CEO Paul White Flags Membership Drive
The coal executive taking over at the helm of the Brisbane Broncos has his eyes set on the thousands of fans who regularly turn up to home games ...

Joe Tripodi's ALP membership suspended
NSW ALP has suspended membership of Joe Tripodi amid a corruption inquiry.

Invite-only memberships expand at Canberra's sky-high lounge
... club &ndash; if they have been lucky enough to get an invite The 15th floor lounge billed as Canberra's most exclusive has quadrupled its membership ...

Resources last updated: 12/7/2015 2:52:53 PM