Send email to new registered user with workflow

Topics: Customizing Orchard, General
Dec 19, 2013 at 3:29 PM

When a new user registers on my Orchard site I'd like to send them an email saying 'Welcome' and giving them useful tips.

I tried creating a workflow that when a new User content item was created sent an email.

If I sent this email to myself it was sent.

I tried sending it to content owner, and then I tried sending it to several tokens that seemed promising:
  • {User.Name}
  • {User.Email}
  • {Content.Author}
When I included those tokens in an email to me, they were all blank.

So, is there a way I can send an email to a user who has just registered?


Dec 29, 2013 at 2:07 PM
Hi Richard,
this isn't a full solution but it's something that I've just started doing myself.
When you develop the workflow add a few notification steps, in the notification step you can select from all of the available fields (there's a little square box in the far right of the text field in the notificaiton activity.

I know that this isn't what you need to solve your problem but I've been trying to debug my stuff over the past few days and this is really usefull.

Hope this helps,
Oct 27, 2014 at 4:25 PM
I have the same issue. If I create a workflow with content created (User) and a notify with a message: Welcome, {User.Name}. It says: Welcome, Anonymous. How can I solve this?
Oct 27, 2014 at 9:47 PM

I think that's not possible out of the box. Because the "User" Token gets always the active logged-in user:
  context.For("User", () => _orchardServices.WorkContext.CurrentUser ?? _anonymousUser)
                .Token("Name", u => u.UserName)
                .Token("Email", u => u.Email)
                .Token("Id", u => u.Id)
                .Chain("Content", "Content", u => u.ContentItem);
You need to implement your own TokenProvider. This should work for you. Now you can use Tokens like
  • {Content.User} -> gets the Username
  • {Content.User.Email} -> Email
  • {Content.User.Id} -> Id
  • {Content.User.UserName} -> also the username
  • {Content.User.Content} -> the contentItem of the user
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Rimango.Tokens.Providers
    using Orchard;
    using Orchard.ContentManagement;
    using Orchard.Localization;
    using Orchard.Tokens;
    using Orchard.Users.Models;

    public class ContentTokens : ITokenProvider
        private readonly IContentManager _contentManager;
        public Localizer T { get; set; }

        public ContentTokens(IContentManager contentManager)
            _contentManager = contentManager;

            T = NullLocalizer.Instance;
        public void Describe(DescribeContext context)
            context.For("Content", T("Content Items"), T("Content Items"))
                .Token("User", T("User"), T("Gets the Username"));

        public void Evaluate(EvaluateContext context)
                .Token("User", content => content.As<UserPart>() != null ? content.As<UserPart>().UserName : null)
                .Chain("User", "User", content => content.As<UserPart>() ?? null);