By: Sourav
May 25 2018

In 5 Easy Steps Create & Manage Newsletter in Your Drupal 8 site

Newsletters are an important marketing tool and a cost-effective way to engage the clients and current base while attracting and building a new customer base, simultaneously.   

In this tutorial, we will learn to create and manage newsletter functionality for your Drupal website using Simplenews.

What is Simplenews?

Simplenews is a popular Drupal module used for creating, sending, and publishing newsletters to the subscribers' list. With this module, both anonymous and authenticated users can opt-in to different mailing lists.

The module is currently available for Drupal 7 and 8.x-1.0-alpha3 (as of 25 May 2018) and a total of 63,878 sites are currently using it.

Let’s start with the step-by-step guide on how you can manage newsletter in your Drupal website.

Module Installation

To integrate your Newsletter, you need to install Simplenews module from Drupal.org. You can use composer to install the module. Run the command given below to start with: 

'drupal/simplenews:^1.0'

Once you have installed the module go to Extend → Enable.

selecting and enabling simplenews

Step I – Configuring the default settings

To start with let's configure the default settings first. Go to 

Configuration → Web Services → Simplenews → Newsletter → Settings. 
editing the default newsletter in the newsletter tab

  1. When in the Newsletter tab

    1. Once there select the Newsletter tab → Default newsletter option  → Format
       
      1. Select your Format  
        1. Plain – Can be used as the default newsletter format. The newsletter will be sent as plain text. 
           
        2. HTML – You need to install Mime Mail module or HTML Mail module to send newsletters in HTML format.
          Emails will be sent coded with HTML. It allows different HTML tags like, <a>, <pre>, <div> etc. also other HTML codes. 
           
      2. Request a read receipt to know the success rate
        Request a read Receipt from your newsletters. A lot of email programs ignore these so it is not a definitive indication of how many people have read your newsletter.
        These options will be the default for new newsletters but can be overridden in the newsletter editing form
        selecting the format and settings in the default newsletter options
         
    2. Enter the information and click Save
      Enter the relevant information of both the sender and receiver. Default sender address that will only be used for confirmation emails.
       
  2. When in the Subscription tab
    Configure for the subscription and unsubscribe emails option according to your need.
     
    1. Add the confirmation email
      Here you have two choices. One is for the user to subscribe/unsubscribe the single newsletter, the other when a user subscribes/unsubscribes from multiple newsletters at once (Combined Confirmation Mails).

      Fill in the details for the confirmation mail in both the single and combined confirmation emails. 
      adding the details such as subject and body text
       
    2. Select the information for the confirmation pages
      Provide Drupal path or the URL of the destination page where the user will be redirected to after the subscription confirmation. 

      adding the confirmation page URL for both subscribe and unsubscribe

      When unsubscribing, the user should be redirected to a confirmation. Add the Drupal path or URL of the destination page where after the unsubscription is confirmed.
       
  3. In the Send mail tab
    In this section, we will learn to use cron to send a newsletter, and how useful can cron turn out to be.
     
    1. Using cron to send newsletters
      Cron is recommended to send newsletters. Just select cron to use it to send newsletters. You can use Cron throttle to set the numbers of newsletters sent per cron run. However, even the failure will also be counted.

      Make sure your cron execution time must not exceed your PHP maximum execution time.
       
    2. Set your mail spool expiration
      This will spool newsletter emails. You have four options (Immediate/1 day/ 1 week/ 2 weeks) and if corn is not used to send messages in this period, it is recommended for immediate expiration. 
       
    3. Track your log emails
      This provides functionality indicates when a message is sent to the PHP mail() function. 
       

Step II – Configuring the default Newsletter category

Here, we will configure the newsletter category. Click on Edit in Default newsletter operation and modify the fields.

Name: Simplenews newsletter
Description: Give a suitable description for your newsletter
  • Select your subscription settings
    It is important to keep in mind that when a new user subscribes s/he gets the best interface. When you are in the subscription settings, you would find four options in the drop-down list – None/ Default on/ Default off/ Silent – select according to your preference.

    Adding the title of the newsletter

    changing the subscription settings

Step III – Creating the first Newsletter

  • Go to Content → Simplenews newsletter → Set the Title → Enter the body → Save

    Admin interface of the newsletter titled as first newsletter

Cheers!! We have successfully created our First Newsletter.
 

Step IV – Test your Newsletter

Test your first newsletter before rolling out. When you view the newsletter you can see the options of 'edit' and 'newsletter'. 

adding the test email address for the test newsletter

Add your test email address, in case of more than one recipient, use a comma to separate each address and click on Send Now
 

Step V – Creating the subscription block

After your successful testing, you need to create the subscription block so more and more people can subscribe to your list. To add the subscription block:

  1. Go to Structure → Block Layout → Choose a region for the subscription block where you would want to add that block and click on Place block.

    placing the block in the tools
     
  2. A pop up will appear on your screen with a list of blocks. Choose the block labeled as Simplenews subscription and click on Place block.
     
  3. Another pop up named Configure block will appear. With it, you can change a title, block message, and add the Unique Id (each subscription block must have a unique form ID).

    If no value is provided, a random ID will be generated. Specify the roles and pages. Click on Save block.
    configuring the block; adding title and selecting display title and default newsletter
  4. Scroll down and click on Save block again. Now, go back to the main page, you will find a block from where one can subscribe just by clicking on Subscribe button.
    subscription block added on the right side of the page

In 5 easy steps, you can now create and manage your own newsletter. Happy Marketing :)  

Let me know in the comments below how you find the guide.