Send Emails Directly From Views Using Views Send in Drupal 7

The Views Send module allows you to compose and send emails directly from a views listing. The module makes it really easy to create a views listing page where an editor can select a few rows and send out mass emails.

For example, if you’re using Drupal Commerce to sell a particular product you could use Views Send to update your customers on the progress of their order. Just make sure you don’t spam the customer with a lot of emails.

A lot of what Views Send does, can be achieved using other modules like Simplenews, Rules and possibly Views Bulk Operations (VBO). However, Views Send is easier to use and the module is fairly lightweight.

In this tutorial, we’ll create a page that lists Drupal users and use Views Send to send out emails.

Getting Started

Obviously, the module depends on Views so make sure you download and install it.

Then, download and install Views Send.

If you use Drush, run the following command:

drush dl views ctools views_send

Create Views Listing Page

The first thing we need to do is create a page that will display a list of Drupal user accounts.

1. Go to Structure, Views and click on “Add new view”.

2. Fill out the “Add new view” form, using the values defined in Table 1.0 and click on “Continue & edit”.

Table 1-0. Create a new view

Option Value
View name Latest users
Machine name latest_users
Show Users sorted by newest first
Create a page Checked
Page title Latest users
Path latest-users
Display format Table

3. In the “Page settings” section, click on “View user profiles” and change the permission to “Administer users”. This will make the page more secure. Only accounts with the permission “Administer users” can access it.

Fig 1.0

4. Now, click on Add in the Fields section and add the “User: E-mail” field to the view.

Fig 1.1

5. Again, click on Add in the Fields section but this time add “Global: Send e-mail” to the view.

Fig 1.2

At this point the view should have three fields: Name, E-mail and “Send e-mail”. Rearrange the fields so that the “Send e-mail” checkbox is on the far left.

Fig 1.3

Send Emails

Now that we have the views page all sorted let’s test it out.

1. Save the view, and go to /latest-users.

Fig 1.4

You should see a bunch of checkboxes and a button called “Send e-mail”.

2. Select a few rows and click on “Send e-mail”.

From this form you can configure a ton of stuff, but the most important fields are the recipient’s e-mail, subject and message.

Fig 1.5

Now, the subject and message fields are used in the actual email. The recipient’s e-mail field is used to define the email address that the message will be sent to.

3. Fill out the form and click Next.

Fig 1.6

If Token is installed, you get access to general tokens that can be used within your email message.

Fig 1.7

4. On the next page, after you’ve clicked on Next, you can preview everything before it’s sent.

Fig 1.8

Once you’re ready, just click on the Send button to send the emails.

That’s a basic demonstration on how to use Views Send. As stated earlier, this type of functionality can be developed using different modules. Using Views Send is just one way of doing it.

If you need to send HTML emails, then I recommend you look at installing Mime Mail.

About The Author

27 thoughts on “Send Emails Directly From Views Using Views Send in Drupal 7”

  1. Dear sir/ madam,
    Your approach is really amazing, I want to check the “sent mails”. Can you tell me how to see that.Is it posiible to put “sent mail ” date as a column in the table.
    Thank you,
    ashk

    1. When you say “I want to check the “sent mails””, you want to know if they have been sent?

      Look in the “Recent log messages” page (admin/reports/dblog).

  2. Thnks for the reply, Yes I can see the recent log msgs as you said. I am looking for “sent email” dates as a separate column in a views table.Is that possible? Do we need to write program for that.?
    Thnks

    1. I don’t think the module tracks when an email was sent. You’ll have to write some custom code to track when it is sent.

  3. This is great, and I have it working, but not all of my view records have email addresses in them. How can I make it so that the check-box is dependent on the existence of a value in the email field? It may just be semantics but it looks funny to have a check-box next to an empty field. ๐Ÿ™‚

  4. here is the message after sending a mail using same procedure:
    1 messages processed.
    Failed sending message to ******@gma**.com – spooling it

    kindly help me out im using wamp server, drupal 7, windows 8

    1. This error means that a mail server hasn’t been setup. I’ve never used WAMP so I don’t know if it ships with a mail server.

      1. To make it work, wat can i do. how to setup mail server? if not, wamp then wat can i use.. ? kindly help me out with ur suggestions and guidelines yaar..

        1. Sorry, but I’ve never setup a dev mail server using WAMP or on Windows. You’ll have to do a bit of research. I would start by googling “wamp mail server”.

  5. “The field used for recipient’s e-mail contains an invalid e-mail address in all selected rows. Maybe choose another field to act as recipient’s e-mail?”
    I am getting above issue while working with views of webform submission data.
    Unable to find reason why?

    1. The problem seems to be with how the webform submission data is passed into Rules. You’ll need to investigate why it’s not passing proper email addresses. Try searching the Webform issue queue.

  6. Yeah i tried this view send module to send mail to users it is working fine.But the page is taking a lot of time to load remaining all pages working fine…I have checked with this page in 3 laptops loading as same…how can i overcome this, any suggestions?

  7. Great tutorial! ..but the “User: E-mail” field is NOT present/show in a list of field ๐Ÿ™

    Any suggestion?

    1. Hi Giuliano,

      Did you select Users from the Show drop-down when creating your view? By default, it’ll be Content.

      Cheers,
      Ivan

  8. Great tutorial, keep it up !

    As you said, this type of functionality can be developed using different modules. Using Views Send is just one way of doing it.

    Can you please point me to any tutorial on how i can develop exactly same functionality using module other than views send ?

    Thank you,

      1. Thank you for the quick reply, do you recommend views send to send bulk/mass email at one time ?
        If no, you happened to know such tutorial to send bulk/mass email using views ?

        It will be more appreciated if you can share it here

        1. Is something stopping you from using “Views Send”? I’d personally try and use a 3rd mail provider like MailChimp.

          I don’t have any other tutorials around using Views to send emails. Normally, Views wouldn’t be used this way.

          1. You are right, views aren’t used for sending emails but i have a case where:
            Any registered user have access to a view displaying thousands of users and i would like to allow any registered user to filter the view as he/she like and then send one customized email to all filtered users (or selected users) at once.
            The registered user has the right to customize only the message body of the email and nothing else.

            The views send module does this approach but after selecting rows and click the “send email” button, a new page appears displaying information to be filled up about the sender’s name & email address, recipient’name & email address and email subject which is not the case i want my the submit email user to have.

  9. Hi, thanks for your work.
    I need some help. A site made in Drupal 7 (not made by me) has been using this module for years. Now they asked to put the form in the same page with views results, so visitors can send the mails in one step instead of three. I canยดt find any hint on how to do this. Any ideas?
    Thanks!

    1. Hi Claudia,

      I don’t think this module support the ability to move the form. Unless they have added the functionality. I haven’t used this module in years.

      Cheers,
      Ivan

  10. My opinion is that the module is incomplete,
    I don’t want to be misunderstood, but the GUI is incorrect, or the module description is not.
    When I read the description of the characteristics on the Drupal website, I thought that my view would fill in the form to send the email for the “To” and Sender name field.
    This is what everyone thinks!
    In reality, the fields remain empty, and I have to assign the view field manually.
    When I select the To field: I have to choose between all the fields of the view, and I could be wrong and insert a different field. I could select Field Name.

    1. Hi Tomas,

      First off, this tutorial is pretty old and it’s for Drupal 7. I haven’t used the module in a very long time.

      I can see you’re frustrated with the module because it doesn’t do what you assume it should do. Offer to fix up the GUI, the description and help out in the issue queue.

      One tip when reviewing modules is to never assume it “works” a particular way. Test it out and see how it works. And if it doesn’t do exactly what you “assume” then offer to help in the issue queue. ๐Ÿ™‚

      Cheers,
      Ivan

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top