예제 #1
0
 /// <summary>
 /// Initializes a new instance of the PSEmailReceiver class.
 /// </summary>
 /// <param name="receiver">The receiver to wrap.</param>
 public PSEmailReceiver(EmailReceiver receiver)
 {
     this.Name                 = receiver.Name;
     this.EmailAddress         = receiver.EmailAddress;
     this.Status               = TransitionHelpers.ConvertNamespace(receiver.Status);
     this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false;
 }
예제 #2
0
        public void ReceiveMailsTest()
        {
            EmailReceiver target = new EmailReceiver(); // TODO: Initialize to an appropriate value

            target.ReceiveMails();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
예제 #3
0
        public IActionResult AddEmailReceiver([FromBody] EmailReceiver emailReceiver)
        {
            emailReceiver.create_time = DateTime.Now;
            bool res = _emailReceiverService.Insert(emailReceiver);

            return(Json(res));
        }
 public TicketConverterModel(TicketService ticketService, UserManager <ApplicationUser> userManager, EmailReceiver emailReceiver, IMailManager mailManager)
 {
     m_ticketService = ticketService;
     m_userManager   = userManager;
     m_emailReceiver = emailReceiver;
     m_mailmanager   = mailManager;
 }
예제 #5
0
        public RetrieveSecureEmailReceiverCredentials()
        {
            var configs = GetConfiguration.GetConfigs;

            EmailReceiver = configs.Configuration.GetSection("EmailReceiver")
                            .Get <EmailReceiver>();
        }
 private void AreEqual(EmailReceiver exp, EmailReceiver act)
 {
     Assert.AreEqual(exp.EmailAddress, act.EmailAddress);
     Assert.AreEqual(exp.Name, act.Name);
     Assert.AreEqual(exp.Status, act.Status);
     Assert.AreEqual(exp.UseCommonAlertSchema, act.UseCommonAlertSchema);
 }
 public AdminMailTicketsModel(EmailReceiver emailReceiver, ApplicationDbContext context, UserManager <ApplicationUser> userManager, IMailManager mailmanager, TicketService ticketService)
 {
     m_emailReceiver = emailReceiver;
     m_context       = context;
     m_userManager   = userManager;
     m_mailmanager   = mailmanager;
     m_ticketService = ticketService;
 }
예제 #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var receiver = new EmailReceiver("imap.gmail.com", 993, "*****@*****.**", "b3foreandafter", "");

            imapClient             = receiver.Receive();
            imapClient.NewMessage += new EventHandler <IdleMessageEventArgs>(this.client_NewMessage);
            this.notif.Icon        = Icon.FromHandle(Resources.printer1.GetHicon());
            Thread.Sleep(0x3e8);
        }
 private static void AreEqual(EmailReceiver exp, EmailReceiver act)
 {
     if (exp != null)
     {
         Assert.Equal(exp.EmailAddress, act.EmailAddress);
         Assert.Equal(exp.Name, act.Name);
         Assert.Equal(exp.Status, act.Status);
     }
 }
예제 #10
0
        /// <summary>
        /// Run the email listener. This opens an email connection to a server and account and processes all the mail headers through the
        /// configured email scanners.
        /// WARNING! This relies on a global, system only schedule. This is not being configured correctly at installation!
        /// </summary>
        /// <param name="scheduledItemRef"></param>
        public override void Execute(EntityRef scheduledItemRef)
        {
            using (new AdministratorContext())
            {
                // fetch all the emails addressed to any inbox in any tenant on this system
                var toAddressFilters = GetToAddressFilterForAllInboxes();
                var emailMessages    = EmailReceiver.GetAllMessages(toAddressFilters);

                foreach (var tenant in Entity.GetInstancesOfType <Tenant>(false))
                {
                    ProcessMessagesForTenant(tenant, emailMessages);
                }
            }
        }
        ///GENMHASH:9CE8C2CD9B4FF3636CD0315913CD5E9D:0B9ABFC681832754AEA179BB66B99F05
        public ActionGroupImpl WithEmail(string emailAddress)
        {
            this.WithoutEmail();

            var compositeKey = this.actionReceiverPrefix + emailSuffix;
            var er           = new EmailReceiver
            {
                Name         = compositeKey,
                EmailAddress = emailAddress
            };

            this.emailReceivers[compositeKey] = er;
            return(this);
        }
예제 #12
0
 public void Update(EmailReceiver obj, out OperationResult operationResult)
 {
     lock (Lock)
     {
         if (obj == null)
         {
             operationResult = new OperationResult {
                 Type = OperationResult.ResultType.Warning
             };
             return;
         }
         Common.Instance.Update
             (obj, objs => objs.EmailReceiverId == obj.EmailReceiverId, out operationResult);
     }
 }
예제 #13
0
 public void Insert(EmailReceiver obj, out OperationResult operationResult)
 {
     lock (Lock)
     {
         if (obj == null)
         {
             operationResult = new OperationResult {
                 Type = OperationResult.ResultType.Warning
             };
         }
         else
         {
             Common.Instance.Insert(obj, out operationResult);
         }
     }
 }
예제 #14
0
        /// <summary>
        /// 發送未寄郵件
        /// </summary>
        public void Send()
        {
            _entEmail    = new Email(_conn);
            _entReceiver = new EmailReceiver(_conn);
            _entFile     = new EmailFile(_conn);
            _entEmail.query(null, _entEmail.EML_STATUS.cds_Equal(""), "", "");
            SmtpClient client = new SmtpClient(Host);

            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Credentials    = new NetworkCredential(Account, Passwd);

            while (_entEmail.read())
            {
                _entReceiver.query(null, _entReceiver.EML_SERNO.cds_Equal(_entEmail.EML_SERNO), "", "");
                _entFile.query(null, _entFile.EML_SERNO.cds_Equal(_entEmail.EML_SERNO), "", "");

                SendMail(client);
            }
            client.ServicePoint.CloseConnectionGroup(client.ServicePoint.ConnectionName);
        }
예제 #15
0
        public void EmailReceiverConstructorTest()
        {
            EmailReceiver target = new EmailReceiver();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
 public AgentMailTicketsModel(EmailReceiver emailReceiver)
 {
     m_emailReceiver = emailReceiver;
 }
예제 #17
0
        /// <summary>
        /// Prepare Email Contents from html template
        /// </summary>
        /// <param name="application">
        /// Application Data
        /// </param>
        /// <param name="htmlString">
        /// Email template string
        /// </param>
        /// <param name="receiver">
        /// Email receiver
        /// </param>
        /// <returns>Key and value pair of the receiver and content</returns>
        public Dictionary <string, EmailContent> PrepareApplicationEmailContents(ApplicationSubmission application, string certificationTeamEmailBodyTemplate, string employerEmailBodyTemplate, EmailReceiver receivers)
        {
            string employerEmailBody          = FillTemplate(application, employerEmailBodyTemplate);
            string certificationTeamEmailBody = FillTemplate(application, certificationTeamEmailBodyTemplate);
            string emailSubject = AppSettings.Get <string>("ApplicationSubmittedEmailSubject");
            var    emails       = new Dictionary <string, EmailContent>();

            if (receivers == EmailReceiver.CertificationTeam || receivers == EmailReceiver.Both)
            {
                emails.Add(Constants.CertificationEmailKey, new EmailContent()
                {
                    Body    = certificationTeamEmailBody,
                    To      = AppSettings.Get <string>("CertificationTeamEmailAddress"),
                    Subject = string.Format("{0} :: {1}", application?.Employer?.PhysicalAddress?.State, emailSubject)
                });
            }
            if (receivers == EmailReceiver.Employer || receivers == EmailReceiver.Both)
            {
                emails.Add(Constants.EmployerEmailKey, new EmailContent()
                {
                    Body    = employerEmailBody,
                    To      = application.ContactEmail,
                    Subject = emailSubject
                });
            }

            return(emails);
        }
 /// <summary>
 /// Initializes a new instance of the PSEmailReceiver class.
 /// </summary>
 /// <param name="receiver">The receiver to wrap.</param>
 public PSEmailReceiver(EmailReceiver receiver)
 {
     this.Name         = receiver.Name;
     this.EmailAddress = receiver.EmailAddress;
     this.Status       = receiver.Status;
 }
예제 #19
0
 public EmailReceiverAdapter(string username, string password, string host, int port)
 {
     _emailReceiver = new EmailReceiver(username, password, host, port);
 }
예제 #20
0
        public IActionResult DeleteEmailReceiver([FromBody] EmailReceiver emailReceiver)
        {
            bool res = _emailReceiverService.Delete(x => x.address == emailReceiver.address);

            return(Json(res));
        }
예제 #21
0
        internal static ActionGroupData DeserializeActionGroupData(JsonElement element)
        {
            Optional <string>            kind     = default;
            Optional <string>            identity = default;
            IDictionary <string, string> tags     = default;
            AzureLocation      location           = default;
            ResourceIdentifier id             = default;
            string             name           = default;
            ResourceType       type           = default;
            SystemData         systemData     = default;
            Optional <string>  groupShortName = default;
            Optional <bool>    enabled        = default;
            Optional <IList <EmailReceiver> >             emailReceivers             = default;
            Optional <IList <SmsReceiver> >               smsReceivers               = default;
            Optional <IList <WebhookReceiver> >           webhookReceivers           = default;
            Optional <IList <ItsmReceiver> >              itsmReceivers              = default;
            Optional <IList <AzureAppPushReceiver> >      azureAppPushReceivers      = default;
            Optional <IList <AutomationRunbookReceiver> > automationRunbookReceivers = default;
            Optional <IList <VoiceReceiver> >             voiceReceivers             = default;
            Optional <IList <LogicAppReceiver> >          logicAppReceivers          = default;
            Optional <IList <AzureFunctionReceiver> >     azureFunctionReceivers     = default;
            Optional <IList <ArmRoleReceiver> >           armRoleReceivers           = default;
            Optional <IList <EventHubReceiver> >          eventHubReceivers          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    identity = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("groupShortName"))
                        {
                            groupShortName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("emailReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <EmailReceiver> array = new List <EmailReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(EmailReceiver.DeserializeEmailReceiver(item));
                            }
                            emailReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("smsReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SmsReceiver> array = new List <SmsReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SmsReceiver.DeserializeSmsReceiver(item));
                            }
                            smsReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("webhookReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <WebhookReceiver> array = new List <WebhookReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(WebhookReceiver.DeserializeWebhookReceiver(item));
                            }
                            webhookReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("itsmReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ItsmReceiver> array = new List <ItsmReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ItsmReceiver.DeserializeItsmReceiver(item));
                            }
                            itsmReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("azureAppPushReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureAppPushReceiver> array = new List <AzureAppPushReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureAppPushReceiver.DeserializeAzureAppPushReceiver(item));
                            }
                            azureAppPushReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("automationRunbookReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AutomationRunbookReceiver> array = new List <AutomationRunbookReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AutomationRunbookReceiver.DeserializeAutomationRunbookReceiver(item));
                            }
                            automationRunbookReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("voiceReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VoiceReceiver> array = new List <VoiceReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VoiceReceiver.DeserializeVoiceReceiver(item));
                            }
                            voiceReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("logicAppReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <LogicAppReceiver> array = new List <LogicAppReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(LogicAppReceiver.DeserializeLogicAppReceiver(item));
                            }
                            logicAppReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("azureFunctionReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureFunctionReceiver> array = new List <AzureFunctionReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFunctionReceiver.DeserializeAzureFunctionReceiver(item));
                            }
                            azureFunctionReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("armRoleReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ArmRoleReceiver> array = new List <ArmRoleReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ArmRoleReceiver.DeserializeArmRoleReceiver(item));
                            }
                            armRoleReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("eventHubReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <EventHubReceiver> array = new List <EventHubReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(EventHubReceiver.DeserializeEventHubReceiver(item));
                            }
                            eventHubReceivers = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ActionGroupData(id, name, type, systemData, tags, location, kind.Value, identity.Value, groupShortName.Value, Optional.ToNullable(enabled), Optional.ToList(emailReceivers), Optional.ToList(smsReceivers), Optional.ToList(webhookReceivers), Optional.ToList(itsmReceivers), Optional.ToList(azureAppPushReceivers), Optional.ToList(automationRunbookReceivers), Optional.ToList(voiceReceivers), Optional.ToList(logicAppReceivers), Optional.ToList(azureFunctionReceivers), Optional.ToList(armRoleReceivers), Optional.ToList(eventHubReceivers)));
        }
예제 #22
0
 /// <summary>
 /// Initializes a new instance of the PSEmailReceiver class.
 /// </summary>
 /// <param name="receiver">The receiver to wrap.</param>
 public PSEmailReceiver(EmailReceiver receiver)
 {
     this.Name         = receiver.Name;
     this.EmailAddress = receiver.EmailAddress;
     this.Status       = TransitionHelpers.ConvertNamespace(receiver.Status);
 }