/// <summary>
 /// Fixed:
 /// </summary>
 public string GetDestinations()
 {
     if (!Contract.Mail())
     {
         return Error.Types.Restricted.MessageJson();
     }
     var siteModel = new ItemModel(ReferenceId).GetSite();
     var ss = siteModel.SitesSiteSettings(ReferenceId);
     return new OutgoingMailsResponseCollection(this)
         .Html("#OutgoingMails_MailAddresses",
             new HtmlBuilder().SelectableItems(
                 listItemCollection: OutgoingMailUtilities.Destinations(
                     referenceId: siteModel.InheritPermission,
                     addressBook: OutgoingMailUtilities.AddressBook(ss),
                     searchRange: DestinationSearchRange,
                     searchText: DestinationSearchText),
                 selectedValueTextCollection: new List<string>())).ToJson();
 }
 /// <summary>
 /// Fixed:
 /// </summary>
 public OutgoingMailModel(string reference, long referenceId)
 {
     if (reference.ToLower() == "items")
     {
         var itemModel = new ItemModel(referenceId);
         ReferenceType = itemModel.ReferenceType;
     }
     else
     {
         ReferenceType = reference.ToLower();
     }
     ReferenceId  = referenceId;
     ReferenceVer = Forms.Int("Ver");
     From         = OutgoingMailUtilities.From();
     SetByForm();
     if (Libraries.Mails.Addresses.FixedFrom(From))
     {
         Body += "\n\n{0}<{1}>".Params(From.DisplayName, From.Address);
     }
 }
        /// <summary>
        /// Fixed:
        /// </summary>
        public string GetDestinations(Context context)
        {
            var siteModel = new ItemModel(
                context: context,
                referenceId: ReferenceId).GetSite(context: context);
            var ss = siteModel.SitesSiteSettings(context: context, referenceId: ReferenceId);

            if (context.ContractSettings.Mail == false)
            {
                return(Error.Types.Restricted.MessageJson(context: context));
            }
            return(new OutgoingMailsResponseCollection(this)
                   .Html("#OutgoingMails_MailAddresses",
                         new HtmlBuilder().SelectableItems(
                             listItemCollection: OutgoingMailUtilities.Destinations(
                                 context: context,
                                 ss: ss,
                                 referenceId: siteModel.InheritPermission,
                                 addressBook: OutgoingMailUtilities.AddressBook(ss),
                                 searchRange: DestinationSearchRange,
                                 searchText: DestinationSearchText),
                             selectedValueTextCollection: new List <string>())).ToJson());
        }