Exemplo n.º 1
0
            private void ValidateSMTPProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
            {
                // Validate the SMTPHost property
                if (String.IsNullOrEmpty(activity.SmtpHost))
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.SmtpHostProperty.Name));

                // Validate the Port property
                if (activity.Port == 0)
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.PortProperty.Name));
                else if (activity.Port < 1)
                    validationErrors.Add(new ValidationError("Invalid Port Number",
                        InvalidSMTPPort, false, SendEmailActivity.PortProperty.Name));
            }
Exemplo n.º 2
0
            private void ValidateEmailProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
            {
                // Validate the To property
                if (String.IsNullOrEmpty(activity.To))
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.ToProperty.Name));
                else if (!activity.To.Contains("@"))
                    validationErrors.Add(new ValidationError("Invalid To e-mail address", InvalidToAddress, false, SendEmailActivity.ToProperty.Name));

                // Validate the From property
                if (String.IsNullOrEmpty(activity.From))
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.FromProperty.Name));
                else if (!activity.From.Contains("@"))
                    validationErrors.Add(new ValidationError("Invalid From e-mail address", InvalidFromAddress, false, SendEmailActivity.FromProperty.Name));
            }