Orchard CMS - Workflow Send Message to Email List - orchardcms-1.7

I would like to send an email notification to a distribution list every time I publish a post on my Orchard CMS blog. The list of emails is contained as a list of custom content items that get created as users submit a custom form to subscribe to emails. I know how to use the workflows feature to send an email notification whenever a content item is created to a fixed list of emails, but I would like to be able to send emails to a list derived from an email field value for instances of a custom content item. Is there an existing way to do this in Orchard, or will I have to write a module to do so?

You will have to write your own Action and a Token to do that.
Your Token will be the Distribution List and the Action of Sending of the mail.
Check orchard.Workflows.Activities, Orchard.Email.Rules (thats the send Email action)

Related

how to send form data in orchard CMS

I'm using a form in my orchard website. How i can sent the form data to an email
address?
My form is like
<form>
<input type="text" name="name">
<input type="submit"name="submit" value="submit">
</form>
Orchard has built-in ways to do this. If you enable the Dynamic Forms, Email Messaging and Email Workflows Activities modules you can build forms and send emails with the submitted values, without writing a single line of code.
When you enable the Email Messaging module you will be prompted to configure the email settings. The only mandatory settings are Sender email address and host name. You can enter any email address here and use localhost for testing purposes.
If you want to show the form on every page, you don't need to edit the Layout.cshtml file. In fact there's rarely a reason to do so. Instead, go to the Widgets menu in the dashboard and add a new Form Widget to the default layer. Which zone you place it in is entirely up to you. In the editor of the widget you can build a form by dragging Dynamic Form elements to the layout.
Once you have your form set up, you can create a new workflow through the Workflows menu that sends an email every time your form is submitted. Simply start off with a Dynamic Form Submitted trigger to begin the workflow and link it to a Send Email activity. You can reference the form values in any of the email fields by using tokens, e.g.:
<div>Name: {FormSubmission.Field:Name}</div>
You can find step by step guides on dynamic forms and workflows in the official documentation:
http://docs.orchardproject.net/en/latest/Documentation/Creating-Dynamic-Forms/
http://docs.orchardproject.net/en/latest/Documentation/Workflows/
Just ignore the part on Custom Forms when you get to Workflows, since those are outdated.

Automate account creation by joining mailing list?

I'm using Wordpress/WooCommerce where users can join the mailing list in MailChimp. But is there a way to also automate account creation after they join the mailing list and generate a temporary password to be sent via email?
Yes, it's possible. Look into MailChimp webhooks.
Basic flow would be:
1. User subscribes
2. MC sends post request to specified callback URL (you can make a page with custom template for example. Easiest way) upon subscription
3. Your page at specified callback URL accepts JSON sent by MC
4. Create new account
5. Send generated password to email
Optionally, you can also set up unsubscribe webhook and remove account when that happens.

Validate the Authenticity of a User For Site Subscriptions

I have a web application that creates user accounts, but I would also like to have the ability to have users that can sign up for subscriptions without accounts. All they have is a subscription page to modify email settings and enable the newsletter subscription.
My questions is how do I verify that the user is who they say they are without a username/password, and my second is how should they access this page. I dont want just anyone typing in the url with the email and access subscription settings for that user.
For each user entry you create a unique access code that you use in the url in order to validate that this is the user you want.
The subscription form will give these options:
subscribe by filling in your email
request to change your settings by just putting your email to another field
both action will send an email to you with a special url
the first to validate that this is made by you so you will enable this user & his email
the second to send him another special url to make any changes to his settings in the case that this use is active in your database.
For this unique code you can use md5 of his email with a timestamp when he was registered.

Newsletter subscription vs Registration

I'd like to have an easy Newsletter subscription box on my site. The user types his email, clicks "Subscribe" and he is done. The problem is that the site has Registration too. How should I solve the registration when the user is subscribed? I do have his/her email address (from Newsletter subscribtion) but I don't know if it is his/her.
I don't want to force the users to Register if they want only to subscribe to the newsletter list.
Should I have 2 email lists for Newsletter subscribers and Registered users and then check duplex emails and send the newsletter only 1x?
If a user signs up for a newsletter but is not a registered member of your website, but later on decides to register, you can do a DB check upon registering them to see if they are subscribed to any newsletters, and if they are, set a 'SubscribedToNewsletter' column to true.
Or, if a registered user decides to sign up for a newsletter, simply set the DB Column 'SubscribedToNewsletter' to true.
If your email client allows groups of contacts you could make two separate groups of contacts. If one of the newsletter people decides to register, they're name should pop up from the newsletter contacts and you can just move it to the registered. Hopefully that should keep you from sending out duplicates each time.

how can one override default registration email in a hook form alter registration?

The main site sends a registration email and I do not want that email to be sent to this new registration as it should have its own custom email. I am having a hard time with this because every time a user registers either on main registration or this custom registration, they get the same mail. How can i keep my custom registration mail separate?
In the administrative interface, you can disable the feature to send email when a user registers. Then, you can just use drupal_mail() and hook_mail() to send your own custom email after the user has registered.
To do that, you will need to use hook_form_alter(), and alter the registration form to redirect to a custom menu callback. After you do that, you can send any email (or do anything else) you want.
Simple way: http://drupal.org/project/advanced_mail_reroute

Resources