Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Hi,

I have a question related to "when logged in as a member"

I have a member site where i post news for are the employees and i would like a function that will send a mail notification to all users when i have posted a new post.

All user leave there mail when register so i would think this should be possible.

Looking forward to get some ideas about this.
Do they agree or deliberately subscribe to your updates? That's the first question that you should put a light on.
RSS Plus an Email Service
This is probably not what you had in mind, but one way would be to create an RSS feed of your blog and use an RSS-to-email service to send the email to your list. I've made several blogs that are connected to Mailchimp accounts. There are other RSS-to-email services that could be used, too.

All Couch
Here's another idea that would be all Couch, but a little more manual. In your blog template, you could add a bit of code for an admin to be able to trigger an email.

Code: Select all
<cms:if k_user_access_level ge '7' >
   <cms:form name="notification" action="#" method="post">
       <cms:if k_success >
           <p>An email was sent to the members.</p>
          <cms:pages masterpage="users/index.php" >
               <cms:send_mail from=k_email_from  to=extended_user_email subject="News from Work" >
                    Your email message goes here.
            </cms:send_mail>
         </cms:pages>
       </cms:if>
      
       <cms:input type="submit" name="submit" value="Send Email" />
    </cms:form>
</cms:if>

This would create a button on the blog post only for a logged-in admin. When they click it, an email is sent out to each of the members. It's one more thing for the admin to have to think about, though.

There are a couple of my ideas. Maybe they will help.
tim wrote: RSS Plus an Email Service
This is probably not what you had in mind, but one way would be to create an RSS feed of your blog and use an RSS-to-email service to send the email to your list. I've made several blogs that are connected to Mailchimp accounts. There are other RSS-to-email services that could be used, too.

All Couch
Here's another idea that would be all Couch, but a little more manual. In your blog template, you could add a bit of code for an admin to be able to trigger an email.

Code: Select all
<cms:if k_user_access_level ge '7' >
   <cms:form name="notification" action="#" method="post">
       <cms:if k_success >
           <p>An email was sent to the members.</p>
          <cms:pages masterpage="users/index.php" >
               <cms:send_mail from=k_email_from  to=extended_user_email subject="News from Work" >
                    Your email message goes here.
            </cms:send_mail>
         </cms:pages>
       </cms:if>
      
       <cms:input type="submit" name="submit" value="Send Email" />
    </cms:form>
</cms:if>

This would create a button on the blog post only for a logged-in admin. When they click it, an email is sent out to each of the members. It's one more thing for the admin to have to think about, though.

There are a couple of my ideas. Maybe they will help.


I did try this but the users get NO mail!
Are you sure that you have the right template name? Maybe your users template has a different name. This example assumes you are using the built in Extended Users functionality. The older Members Module uses slightly different variable names.

To troubleshoot, start with this:

Code: Select all
   <cms:form name="notification" action="#" method="post">
       <cms:if k_success >
          <cms:pages masterpage="users/index.php" >
               <cms:show extended_user_email/>
               <cms:dump/>
         </cms:pages>
       </cms:if>
     
       <cms:input type="submit" name="submit" value="Send Email" />
    </cms:form>

On submission, it should show each member email in turn followed by a long list of Couch variables. You can look through those variables for the one you need.
5 posts Page 1 of 1