Exemple #1
0
        /// <summary>
        /// INVIA MAIL
        /// Intanto così, poi si aggiungerà quello che serve, ma almeno centralizzo l'invio (almeno per quel che mi serve ora...)
        /// </summary>
        /// <param name="Content">TEsto mail</param>
        /// <param name="Address">Indirizzo</param>
        /// <param name="OtherParameters">Gli altri parametri che serviranno per l'invio</param>
        /// <returns>
        /// True: mail inviata
        /// False: errori invio...
        /// </returns>
        private bool NotificationSendMail(
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data,
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage Message,
            String Address)
        {
            if (Data == null)
            {
                Message.Translation.Body    = Domain.DTO.DTO_NotificationData.RemoveTags(Message.Translation.Body);
                Message.Translation.Subject = Domain.DTO.DTO_NotificationData.RemoveTags(Message.Translation.Subject);
            }
            else
            {
                Message.Translation.Body    = Data.AnalyzeContent(Message.Translation.Body, Settings);
                Message.Translation.Subject = Data.AnalyzeContent(Message.Translation.Subject, Settings);
            }

            bool sentMail = ServiceTemplate.SendMail(
                this.CurrentPerson,
                Settings.SmtpConfig,
                Message.MailSettings,
                Message.Translation.Subject,
                Message.Translation.Body,
                Address);

            return(sentMail);
        }
Exemple #2
0
        public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation NotificationGetTemplatePreview(
            Boolean isHtml,
            lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation content,
            Domain.DTO.DTO_NotificationSettings settings, Domain.DTO.DTO_NotificationData fullData,
            ModuleTicket.MailSenderActionType Action)
        {
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData
            {
                Action   = null,
                Answer   = null,
                Category = null,
                Ticket   = null,
                User     = null
            };

            //Creato l'oggetto "DATA" secondo i casi:
            switch (Action)
            {
            case ModuleTicket.MailSenderActionType.externalPasswordChanged:
                Data.User = fullData.User;
                break;

            case ModuleTicket.MailSenderActionType.externalRecover:
                Data.User = fullData.User;
                break;

            case ModuleTicket.MailSenderActionType.externalRegistration:
                Data.User = fullData.User;
                break;


                //////////////////////////case ModuleTicket.MailSenderActionType.addAnswer:
                //////////////////////////    Data.Ticket = fullData.Ticket;
                //////////////////////////    Data.Action = fullData.Action;
                //////////////////////////    break;
                //////////////////////////case ModuleTicket.MailSenderActionType.assignmentChange:
                //////////////////////////    Data.Ticket = fullData.Ticket;
                //////////////////////////    Data.Action = fullData.Action;
                //////////////////////////    break;
                //////////////////////////case ModuleTicket.MailSenderActionType.statusChange:
                //////////////////////////    Data.Ticket = fullData.Ticket;
                //////////////////////////    Data.Action = fullData.Action;
                //////////////////////////    break;
                //////////////////////////case ModuleTicket.MailSenderActionType.categoryChange:
                //////////////////////////    Data.Category = fullData.Category;
                //////////////////////////    Data.Action = fullData.Action;
                //////////////////////////    break;
                //////////////////////////case ModuleTicket.MailSenderActionType.categoryAssignedChange:
                //////////////////////////    Data.Category = fullData.Category;
                //////////////////////////    Data.Action = fullData.Action;
                //////////////////////////    break;
            }

            return(NotificationAnalyzeContent(
                       isHtml,
                       content,
                       settings,
                       Data));
        }
Exemple #3
0
        /// <summary>
        /// Invio mail con password - ToDo
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendRecover(
            Domain.TicketUser User,
            Domain.DTO.DTO_NotificationSettings Settings,
            String NewPassword)
        {
            //Testo esempio:

            /* Le sue credenziali per l'accesso al servizio ticket sono le seguenti:
             * Mail: [PlaceHoldersType.UserMail]
             * Password: [PlaceHoldersType.UserPassword]
             * Indirizzo per l'accesso: [PlaceHoldersType.UserTokenUrl]
             */

            //Creo oggetto SETTINGS (me lo farò passare...)
            //Settings.LangCode = User.LanguageCode;

            // = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null,
            //    IntTicketStatus = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? true : false;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = NewPassword,
                Token        = null
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRecover);

            if (msg == null)
            {
                return(false);
            }

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Mail));
        }
Exemple #4
0
        //private Domain.DTO.Notification.DTO_Answer NotificationGetFakeAnswer(String SampleTextShort, String SampleTextLong)
        //{
        //    return new Domain.DTO.Notification.DTO_Answer
        //        {
        //            FullText = SampleTextLong,
        //            ShortText = SampleTextShort
        //        };
        //}
        //private Domain.DTO.Notification.DTO_Action NotificationGetFakeAction()
        //{
        //    return new Domain.DTO.Notification.DTO_Action
        //    {
        //        UserDisplayName = "User DisplayName",
        //        UserRole = "User Role"
        //    };
        //}
        //private Domain.DTO.Notification.DTO_User NotificationGetFakeUser(bool HasToken)
        //{
        //    return new Domain.DTO.Notification.DTO_User
        //        {
        //            LanguageCode = "IT-it",
        //            Mail = "*****@*****.**",
        //            Name = "User_Name",
        //            Surename = "User_SureName",
        //            Password = "******",
        //            Token = HasToken ? new Domain.DTO.Notification.DTO_User.DTO_Token
        //            {
        //                Code = new Guid().ToString(),
        //                Creation = DateTime.Now
        //            } : null
        //        };
        //}
        //private Domain.DTO.Notification.DTO_Ticket NotificationGetFaketicket(String SampleTextShort, String SampleTextLong)
        //{
        //    Dictionary<string, string> DictCategory = new Dictionary<string, string>();
        //    DictCategory.Add(LangMultiCODE, "Category Name (multi)");
        //    DictCategory.Add("it-IT", "Nome Categoria");
        //    DictCategory.Add("en-US", "Category Name");

        //    return new Domain.DTO.Notification.DTO_Ticket
        //        {
        //            Assigner = "Assigner Displayname",
        //            CategoryCurrent = DictCategory,
        //            CategoryInitial = DictCategory,
        //            CreatorDisplayName = "Creator DisplayName",
        //            Language = "Italiano",
        //            LanguageCode = "it-IT",
        //            LongText = SampleTextLong,
        //            Preview = SampleTextShort,
        //            SendDate = DateTime.Now,
        //            Status = Domain.Enums.TicketStatus.open,
        //            Title = "Ticket Title"
        //        };
        //}
        //private Domain.DTO.Notification.DTO_Category NotificationGetFakeCategory(String SampleTextShort)
        //{
        //    IList<String> Languages = new List<String>();
        //    Languages.Add(LangMultiCODE);
        //    Languages.Add("Italiano");
        //    Languages.Add("English");

        //    IList<Domain.DTO.Notification.DTO_CategoryLocalization> CatLocals = new List<Domain.DTO.Notification.DTO_CategoryLocalization>();

        //    CatLocals.Add(new Domain.DTO.Notification.DTO_CategoryLocalization
        //    {
        //        Description = SampleTextShort,
        //        Name = "Category Name",
        //        Language = LangMultiCODE,
        //        LanguageCode = LangMultiCODE
        //    });
        //    CatLocals.Add(new Domain.DTO.Notification.DTO_CategoryLocalization
        //    {
        //        Description = SampleTextShort,
        //        Name = "Nome Categoria",
        //        Language = "Italiano",
        //        LanguageCode = "it-IT"
        //    });
        //    CatLocals.Add(new Domain.DTO.Notification.DTO_CategoryLocalization
        //    {
        //        Description = SampleTextShort,
        //        Name = "Category Name",
        //        Language = "Italiano",
        //        LanguageCode = "it-IT"
        //    });

        //    return new Domain.DTO.Notification.DTO_Category
        //        {
        //            Description = SampleTextShort,
        //            LanguagesCodeList = Languages,
        //            Name = "Category Name",
        //            NewAssignerDisplayName = "New Assigner DisplayName",
        //            Type = Domain.Enums.CategoryType.Public,
        //            NameAndDescriptionLIST = CatLocals
        //        };
        //}
        #endregion

        public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation NotificationGetTemplatePreview(
            Boolean isHtml,
            lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation content,
            Domain.DTO.DTO_NotificationSettings settings,
            Domain.DTO.DTO_NotificationData data)
        {
            return(NotificationAnalyzeContent(
                       isHtml,
                       content,
                       settings,
                       data));
        }
Exemple #5
0
        /// <summary>
        /// Analizza il contenuto di content e converte i Tag in Valori
        /// </summary>
        /// <param name="content">Testo da analizzare</param>
        /// <param name="LangCode">Codice lingua</param>
        /// <param name="DateTimeFormat">Formato data/ora</param>
        /// <param name="BaseUrl">BaseUrl dell'applicazione</param>
        /// <param name="IntTicketStatus"></param>
        /// <param name="IntCategoryType"></param>
        /// <param name="CategoriesTemplate"></param>
        /// <returns></returns>
        public String AnalyzeContent(
            String content,
            DTO_NotificationSettings Settings
            )
        {
            if (User != null)
            {
                content = User.AnalyzeContent(content, Settings.DateTimeFormat, Settings.BaseUrl);
            }
            else
            {
                content = Notification.DTO_User.RemoveTags(content);
            }

            if (Ticket != null)
            {
                content = Ticket.AnalyzeContent(content, Settings.DateTimeFormat, Settings.AvailableTicketStatus, Settings.LangCode, Settings.BaseUrl);
            }
            else
            {
                content = Notification.DTO_Ticket.RemoveTags(content);
            }

            if (Category != null)
            {
                content = Category.AnalyzeContent(content, Settings.AvailableCategoryTypes, Settings.CategoriesTemplate);
            }
            else
            {
                content = Notification.DTO_Category.RemoveTags(content);
            }

            if (Answer != null)
            {
                content = Answer.AnalyzeContent(content);
            }
            else
            {
                content = Notification.DTO_Answer.RemoveTags(content);
            }

            if (Action != null)
            {
                content = Action.AnalyzeContent(content);
            }
            else
            {
                content = Notification.DTO_Action.RemoveTags(content);
            }

            return(content);
        }
Exemple #6
0
        public bool NotificationSendPasswordChanged(Int64 UserId, Domain.DTO.DTO_NotificationSettings Settings)
        {
            if (UserId < 0)
            {
                return(false);
            }

            Domain.TicketUser user = Manager.Get <Domain.TicketUser>(UserId);

            if (user == null || user.Id <= 0)
            {
                return(false);
            }

            return(NotificationSendPasswordChanged(user, Settings));
        }
Exemple #7
0
        /// <summary>
        /// Invio mail per reset password - ToDo
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendPasswordChanged(Domain.TicketUser User, Domain.DTO.DTO_NotificationSettings Settings)
        {
            ////Creo oggetto SETTINGS (me lo farò passare...)
            //Domain.DTO.DTO_NotificationSettings Settings = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null,
            //    IntTicketStatus = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? true : false;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = "",
                Token        = null
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalPasswordChanged);

            if (msg != null)
            {
                return(NotificationSendMail(Settings, Data, msg, Mail));
            }


            return(true);

            // Invio Mail.
        }
Exemple #8
0
        /// <summary>
        /// Analizza e converte i Tag di Content in valori
        /// </summary>
        /// <param name="isHtml">NON UTILIZZATO</param>
        /// <param name="content">Testo da analizzare</param>
        /// <param name="Data">Dati da utilizzare: SE NULL, rimuove TUTTI i tag!</param>
        /// <param name="Settings">Impostazioni</param>
        /// <returns></returns>
        public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation NotificationAnalyzeContent(
            Boolean isHtml,
            lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation content,
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data)
        {
            if (Data == null)
            {
                content.Body    = Domain.DTO.DTO_NotificationData.RemoveTags(content.Body);
                content.Subject = Domain.DTO.DTO_NotificationData.RemoveTags(content.Subject);
            }
            else
            {
                content.Body    = Data.AnalyzeContent(content.Body, Settings);
                content.Subject = Data.AnalyzeContent(content.Subject, Settings);
            }

            return(content);
        }
Exemple #9
0
        /// <summary>
        /// Invio notifiche automatiche
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <param name="OtherParameters">Altri parametri da definire...</param>
        /// <returns></returns>
        /// <remarks>
        /// ATTENZIONE! Sarà necessario creare funzioni "ad hoc" con relativi parametri necessari.
        /// </remarks>
        public bool NotificationSend(
            ModuleTicket.MailSenderActionType ActionType,
            Domain.DTO.DTO_NotificationSettings Settings,
            Domain.DTO.DTO_NotificationData Data,
            String Address)
        {
            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRegistration);

            if (msg == null)
            {
                return(false);
            }

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Address));
        }
        public Domain.Enums.AccessRecoverError UserRecover(String Mail,
                                                           Domain.DTO.DTO_NotificationSettings Settings)
        {
            if (!MailCheckFormat(Mail))
            {
                return(Domain.Enums.AccessRecoverError.MailFormat);
            }

            Domain.TicketUser User = Manager.GetAll <Domain.TicketUser>(u => u.mail == Mail || u.Person != null && u.Person.Mail == Mail).FirstOrDefault();

            if (User == null || User.Id <= 0)
            {
                return(Domain.Enums.AccessRecoverError.MailNotFound);
            }

            if (!User.MailChecked)
            {
                return(Domain.Enums.AccessRecoverError.MailNotChecked);
            }

            //Setto nuova password per l'utente
            String Pwd        = PasswordGetNew();
            String EncodedPwd = AuthenticationHelper.Encrypt(Pwd);


            User.Code = EncodedPwd;
            User.UpdateMetaInfo(CurrentPerson, UC.IpAddress, UC.ProxyIpAddress);
            Manager.SaveOrUpdate <Domain.TicketUser>(User);

            if (!NotificationSendRecover(User, Settings, Pwd))
            {
                return(Domain.Enums.AccessRecoverError.InternalError);
            }


            return(Domain.Enums.AccessRecoverError.none);
        }
        /// <summary>
        /// Crea utente da esterno
        /// </summary>
        /// <param name="Name">Nome</param>
        /// <param name="Sname">cognome</param>
        /// <param name="Mail">Mail</param>
        /// <returns></returns>
        public Domain.DTO.DTO_ExtUserAddResult UserCreateFromExternal(
            String Name,
            String Sname,
            String Mail,
            String LangCode,
            String Code,
            Domain.DTO.DTO_NotificationSettings Settings)
        {
            Domain.DTO.DTO_ExtUserAddResult response = new Domain.DTO.DTO_ExtUserAddResult();
            response.Errors = Domain.Enums.ExternalUserCreateError.none;

            // 1. Check formato MAIL
            if (!MailCheckFormat(Mail))
            {
                response.User.UserId   = 0;
                response.User.PersonId = 0;
                response.Errors        = Domain.Enums.ExternalUserCreateError.invalidMail;
                return(response);
            }



            litePerson SysPerson  = null;
            Boolean    IsInternal = false;



            // 2. Controllo se In TicketSystem
            TicketUser User = (from TicketUser usr in Manager.GetIQ <TicketUser>()
                               where usr.mail == Mail ||
                               usr.Person != null && usr.Person.Mail == Mail
                               select usr).Skip(0).Take(1).ToList().FirstOrDefault();

            // Utente in Ticket System, con password già impostata: Utilizzare RECUEPRA PASSWORD (err.TicketMail)
            if (User != null && User.Id > 0)
            {
                response.User.UserId = User.Id;

                //Utente INTERNO!    -   MAIL VALIDA!!!
                if (User.Person != null)
                {
                    response.User.PersonId = User.Person.Id;
                    SysPerson  = User.Person;
                    IsInternal = true;

                    if (!String.IsNullOrEmpty(User.Code))
                    {
                        response.Errors = Domain.Enums.ExternalUserCreateError.TicketMail;
                        return(response);
                    }
                }
                else
                {
                    // UTENTE INTERNO - contorllo se MAIL CHECKATA:
                    // Sì: usare recupera password
                    // NO: ovverride Utente con dati forniti!

                    response.User.PersonId = 0;

                    if (User.MailChecked)
                    {
                        response.Errors = Domain.Enums.ExternalUserCreateError.TicketMail;
                        return(response);
                    }
                }

                //L'utente verrà aggiornato!
                User.UpdateMetaInfo(CurrentPerson, UC.IpAddress, UC.ProxyIpAddress);
            }
            else
            {
                //NUOVO UTENTE TICKET!
                User = new TicketUser();
                User.CreateMetaInfo(CurrentPerson, UC.IpAddress, UC.ProxyIpAddress);
                User.Enabled = true;

                //3. Controllo se In Sistema
                SysPerson = (from litePerson prsn in Manager.GetIQ <litePerson>() where prsn.Mail == Mail select prsn).Skip(0).Take(1).ToList().FirstOrDefault();

                if (SysPerson != null && SysPerson.Id > 0)
                {
                    IsInternal      = true;
                    response.Errors = Domain.Enums.ExternalUserCreateError.internalMail;
                }
                else
                {
                    IsInternal = false;
                    SysPerson  = null;
                }
            }


            if (IsInternal)
            {
                User.Name   = "";
                User.Sname  = "";
                User.mail   = "";
                User.Person = SysPerson;
            }
            else
            {
                User.Name  = Name;
                User.Sname = Sname;
                User.mail  = Mail;
            }

            User.MailChecked  = false;
            User.LanguageCode = LangCode;
            User.Code         = AuthenticationHelper.Encrypt(Code);
            Manager.SaveOrUpdate <TicketUser>(User);

            //Aggiorno i campi di REsponse con quelli in dB.
            if (IsInternal)
            {
                response.User.Name  = User.Person.Name;
                response.User.SName = User.Person.Surname;
            }
            else
            {
                response.User.Name  = User.Name;
                response.User.SName = User.Sname;
            }
            //response.DisplayName = (String.IsNullOrEmpty(User.DisplayName) ? User.Sname + " " + User.Name : User.DisplayName);

            response.User.Mail = User.mail;

            //MAIL CONVALIDA:
            // 1. GENERO CODICE VERIFICA
            Token tok = this.TokenCreate(User.Id, Domain.Enums.TokenType.Registration);

            // 2. Lo invio
            Boolean Sended = this.NotificationSendToken(User, Settings, tok, Code);

            response.Note = "<br/>Token: " + tok.Code.ToString() + "<br/>Expire on: " + tok.CreatedOn.Add(TokenLifeTime).ToString();
            //x TEST:
            if (Sended)
            {
                response.Note += "<br/> - SENDED -";
            }
            else
            {
                response.Note += "<br/> - SENDING ERROR! -";
            }

            // Eventuali errori:    response.Errors = Domain.Enums.ExternalUserCreateError.internalError;

            return(response);
        }
Exemple #12
0
        /// <summary>
        /// Invio Token/URL per la validazione dell'utente
        /// </summary>
        /// <param name="NotificationType">Tipo notifica</param>
        /// <returns></returns>
        public bool NotificationSendToken(TicketUser User, Domain.DTO.DTO_NotificationSettings Settings, Token Token, String Password)
        {
            //Testo esempio:

            /* Gentile [PlaceHoldersType.UserSureName] [PlaceHoldersType.UserName]
             * Il suo account è stato registrato nel sistema.
             *
             * Dati Account:
             * Mail: [PlaceHoldersType.UserMail]
             * Password: [PlaceHoldersType.UserPassword]
             * Lingua: [PlaceHoldersType.UserLanguageCode]
             *
             * Per attivarlo è necessario accedere con le proprie credenziali al seguente indirizzo:
             * [PlaceHoldersType.UserTokenUrl]
             *
             * Oppure dalla pagine di accesso, al primo tentativo verrà richiesto il seguente codice di convalida:
             * [PlaceHoldersType.UserToken]
             *
             * La conferma dell'account può essere effettuata entro il: [PlaceHoldersType.UserTokenExpiration]
             */


            //To Do!!!
            //Domain.Enums.Notification NotificationType = Domain.Enums.Notification.ExternalRegistration;

            //Creo oggetto SETTINGS (me lo farò passare...)
            //Domain.DTO.DTO_NotificationSettings Settings = new Domain.DTO.DTO_NotificationSettings
            //{
            //    BaseUrl = "http://blablalba",
            //    DateTimeFormat = "0:dd/MM/yy H:mm:ss",
            //    LangCode = User.LanguageCode,
            //    CategoriesTemplate = "",
            //    IntCategoryType = null, IntTicketStatus= null,
            //    SmtpConfig = null
            //};

            //Creo oggetto DATA
            Domain.DTO.DTO_NotificationData Data = new Domain.DTO.DTO_NotificationData();
            bool   IsPerson = (User.Person == null) ? false : true;
            String Mail     = IsPerson ? User.Person.Mail : User.mail;

            Data.User = new Domain.DTO.Notification.DTO_User
            {
                LanguageCode = User.LanguageCode,
                Mail         = Mail,
                Name         = IsPerson ? User.Person.Name : User.Name,
                Surname      = IsPerson ? User.Person.Surname : User.Sname,
                Password     = Password,
                Token        = new Domain.DTO.Notification.DTO_User.DTO_Token
                {
                    Code     = Token.Code.ToString(),
                    Creation = Token.CreatedOn
                }
            };

            //Recupero messaggio
            lm.Comol.Core.Notification.Domain.dtoNotificationMessage msg =
                ServiceTemplate.GetNotificationMessage(
                    Data.User.LanguageCode,
                    ModuleTicket.UniqueCode,
                    (Int64)ModuleTicket.MailSenderActionType.externalRegistration);

            if (msg == null)
            {
                return(false);
            }

            // Invio Mail.
            return(NotificationSendMail(Settings, Data, msg, Mail));
        }