3

I would like to know a good user friendly, easy to setup and flexible way to send automated emails to users. This will be in response to an event triggered by a user. I guess it does not matter what it is for. Just need a good way to send system emails, which is widely used.

0

2 Answers 2

1

Only using Rules may not be sufficient

The Rules module, as suggested in the previous answer, is indeed capable to perform these Rules Actions:

  • Send Mail.
  • Send mail to all users of a role.

However, if you have not installed any other modules (that integrate with Rules), that's really it (eg Send HTML e-mail is only available if you also install some other module which integrates with Rules).

Message stack

As per the "most flexible way to send eMails"-part of the question, Rules is only a part of the answer. I recommend you to also have a look at the Message Stack. These are the basic components and dependencies of it:

enter image description here

Some more details about the Message-related modules (=quotes are from the module's project page):

  • Message:

    The Message module is the core of the message stack. It enables logging and displaying system events in a number of different use cases. Events that are recorded over time are sometimes call activity streams. Exportable messages subtypes can be created for different use cases with custom fields and display (view) modes.

  • Message Notify.

    This module provides a method for sending a message via a notifier plugin. Message Notify comes with plugins for email and SMS and may be extended to other transport mechanisms as required.

  • Message Subscribe.

    With this module, users who subscribe to content will be notified when events occur that involve that content. The module leverages the Flag module, which provides a subscribe functionality to users.

Quite a few popular Drupal distributions already adopted to this Message Stack, Open Atrium is one of them.

If you'd rather look at an existing module as an example, then checkout the 7.x-4.x version of the Answers module (disclosure: I'm a co-maintainer) and its Answers Notification sub-module. This sub-module allows logged in users to subscribe to selected questions, so that they receive notifications (using the Message Stack) when Questions receive Answers.

Create a Message archive (audit trail)

By using the Message module, you automagically also create an archive of all Messages. Which is very handy in cases such as when a user claims to never have received some eMail. In such cases, with only Rules, think about how you'd proof that some eMail was mailed somewhere in the past ... as compared to using Message and just bring up that message again ...

Combining Rules and Message

Moreover, by using the technique of Replacement tokens, it's possible to create your own Message-"tokens" using ... Rules! If these Replacement Tokens don't mean anything to you (ie you don't understand what they are really about), then head over to the answer to What's the purpose of "Replacement tokens" of a Message type? for (way) more details on that.

2

I think the most easy and user friendly way for you is to use Rules module.

EXAMPLE: Create new rule enter image description here Add action enter image description here enter image description here enter image description here

Follow next steps to set your mail.

4
  • Note that Send HTML mail is only available if you have Mime Mail module installed, otherwise use Send mail
    – No Sssweat
    Commented Dec 10, 2016 at 12:15
  • Is mime mail the best solution out there? I found these 2 articles configure smtp and Drupal mail system. What do you say?
    – Umair
    Commented Dec 10, 2016 at 13:24
  • For your information, the event is not available in rules so I have to use the trigger module for triggering the action on that event. You commented on one of my previous post Missing events
    – Umair
    Commented Dec 10, 2016 at 13:27
  • @Umair please use the @username when you reply to someone, other wise they do not get a notification. I just happened to look at this Q again by chance. Anyways, the mime mail module allows you to use HTML inside of your e-mails. If you do not have it installed, you do not get the Send HTML mail as I mentioned earlier.
    – No Sssweat
    Commented Dec 12, 2016 at 12:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.