/// <summary>
 /// The constructor takes GenericRepositories as argument, which is automatically created by ninject in NinjectWebCommon.
 /// This enables us to quickly get references to our context, by simply typing, for
 /// example, "IGenericRepository<Course> courseRepository", which we can use right away.
 /// Whenever a changes is made, use _unitOfWork.Save() to save any changes.
 /// </summary>
 /// <param name="unitOfWork"></param>
 /// <param name="studentRepository"></param>
 /// <param name="emailService"></param>
 /// <param name="mailHandler"></param>
 public StudentController(IUnitOfWork unitOfWork, IGenericRepository <Student> studentRepository, IIdentityMessageService emailService, IMailHandler mailHandler)
 {
     _studentRepository = studentRepository;
     _emailService      = emailService;
     _mailHandler       = mailHandler;
     _unitOfWork        = unitOfWork;
 }
Пример #2
0
        public static Result <MimeMessage> ProcessEmail(MimeMessage originalEmail, string from, ISettingsStore settingsStore, TelemetryClient telemetry)
        {
            var userId       = originalEmail.From.Mailboxes.First().HashedEmail();
            var settings     = settingsStore.GetCurrentSettings(userId);
            var customSheets = settingsStore.GetCustomSheets(userId).ToList();

            var attachments = originalEmail.LoadAttachments().ToList();
            var handlers    = new IMailHandler[]
            {
                new AppleHealthAttachmentMailHandler(from, settings, customSheets),
                new AppleHealthGoogleDriveMailHandler(from, settings, customSheets),
                new SettingsUpdateMailHandler(from, settingsStore),
                new HelpMailHandler(from), // <-- catch all
            };

            try
            {
                return(handlers
                       .First(h => h.CanHandle(originalEmail, attachments))
                       .Process(originalEmail, attachments));
            }
            catch (Exception e)
            {
                return(Result.Failure(MailUtility.ConstructErrorMessage(originalEmail, from, e), e));
            }
        }
Пример #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="channelManager">channel handler</param>
 /// <param name="mailQueue">mail queue</param>
 public RaspEmailReplyChannel(ChannelManagerBase channelManager, IMailHandler mailHandler, MailSoap12TransportBinding msg, RaspEmailBindingElement bindingElement)
     : base(channelManager)
 {
     _msg                    = msg;
     _mailHandler            = mailHandler;
     _asyncTryReceiveRequest = new AsyncTryReceiveRequest(TryReceiveRequest);
     _bindingElement         = bindingElement;
 }
Пример #4
0
 public UserController(IUserService userService, IGlobalServices globalService,
                       IHostingEnvironment hostingEnvironment, IMailHandler handler)
 {
     _userService        = userService;
     _globalService      = globalService;
     _hostingEnvironment = hostingEnvironment;
     _handler            = handler;
 }
 public NotificationHandler(
     IPetRepository petRepository,
     INotificationRepository notificationRepository,
     IMapper mapper,
     IUnitOfWork unitOfWork,
     IMailHandler mailHandler,
     IUserHandler userHandler,
     IUserRepository userRepository,
     IEmailHistoryRepository emailHistoryRepository,
     MailSettings mailSettings)
 {
     _petRepository          = petRepository;
     _notificationRepository = notificationRepository;
     _mapper                 = mapper;
     _unitOfWork             = unitOfWork;
     _petRepository          = petRepository;
     _notificationRepository = notificationRepository;
     _mailHandler            = mailHandler;
     _userHandler            = userHandler;
     _userRepository         = userRepository;
     _emailHistoryRepository = emailHistoryRepository;
     _mailSettings           = mailSettings;
 }
Пример #6
0
        public void Startup(IAgileOutlookAddIn baseAddin,IMailHandler mailHandler)
        {
            foreach (var tagger in Taggers)
            {
                tagger.Startup(baseAddin, this);

            }
            mailHandler.MailReceived += new MailEvent(Mail_Received);
            mailHandler.MailSent += new MailEvent(Mail_Sent);
        }
Пример #7
0
 public SmtpListener(ISmtpConfiguration configuration, ILogger logger, IMailHandler mailHandler)
 {
     _configuration = configuration;
     _logger        = logger;
     _mailHandler   = mailHandler;
 }
Пример #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="mailHandler">outbox used for sending</param>
 /// <param name="remoteAddress">remote address to which the request channel sends messages</param>
 /// <param name="channelManager">channel handler</param>
 public RaspEmailRequestChannel(IMailHandler mailHandler, EndpointAddress remoteAddress, ChannelManagerBase channelManager)
     : base(channelManager)
 {
     _mailHandler   = mailHandler;
     _remoteAddress = remoteAddress;
 }
Пример #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="msg">The incoming System.ServiceModel.Channels.Message that contains the request</param>
 /// <param name="mailHandler">mailhandler</param>
 public RaspEmailRequestContext(MailSoap12TransportBinding msg, IMailHandler mailHandler, RaspEmailBindingElement bindingElement)
 {
     _requestMessage = msg;
     pMailHandler    = mailHandler;
     _bindingElement = bindingElement;
 }
Пример #10
0
 public RouteContainer(IMailHandler handler, string routeMsg)
 {
     MailHandler  = handler;
     RouteMessage = routeMsg;
 }
Пример #11
0
 public ContactController(IMailHandler mailHandler, ContactDbContext context, IOptions <MailHandler> mailOptions)
 {
     _mailHandler = mailHandler;
     _context     = context;
     _mailOptions = mailOptions;
 }
Пример #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="firstMessage">The first message in the queue</param>
 /// <param name="mailHandler">The mail handler from which the rest of the messages will be gotten</param>
 public RaspEmailQueue(MailSoap12TransportBinding firstMessage, RaspMailHandler mailHandler)
     : base(mailHandler)
 {
     _firstMessage = firstMessage;
     _mailHandler  = mailHandler;
 }
Пример #13
0
 public void InitializeSyncTimesAccounts(DateTime time,
     IMailHandler mailHandler)
 {
     SyncTimes.Clear();
     //Outlook.NameSpace nameSpace = null;
     //Outlook.Folders profileFolders = null;
     var profileFolders = mailHandler.GetWatchFolders();
     try
     {
         //if (mailHandler.OutlookApp == null) return;
         //nameSpace = OutlookApp.GetNamespace("MAPI");
         //if (nameSpace != null)
         //{
         //    profileFolders = nameSpace.Folders;
         //    int numberOfProfiles = profileFolders.Count;
         for (int i = 0; i < profileFolders.Count; i++)
             {
                 var currProfile = profileFolders[i];
                 if (currProfile != null)
                 {
                     SyncTime NewTime = new SyncTime();
                     NewTime.AccountID = currProfile.EntryID;
                     NewTime.LatestTime = time;
                     SyncTimes.Add(NewTime);
                     //Marshal.ReleaseComObject(currProfile);
                 }
             }
         //}
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         //if (nameSpace != null)
             //Marshal.ReleaseComObject(nameSpace);
         if (profileFolders != null)
         {
             profileFolders.ToList().ForEach(m => Marshal.ReleaseComObject(m));
         }
             //Marshal.ReleaseComObject(profileFolders);
     }
 }
Пример #14
0
 public SmtpClientSession(ILogger logger, IMailHandler mailHandler)
 {
     _logger      = logger;
     _mailHandler = mailHandler;
 }
 public EjemploEnviarEmailController(IMailHandler mailHandler)
 {
     _mailHandler = mailHandler;
 }