Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public void CanCompare()
        {
            EMail e1a = new EMail("*****@*****.**");
              EMail e1b = new EMail("*****@*****.**");
              EMail e2 = new EMail("*****@*****.**");

              Assert.AreEqual(e1a, e1b);
              Assert.AreNotEqual(e1a, e2);
        }
Exemplo n.º 2
0
        protected virtual void OnSending(EMail sender, MailEventArgs e)
        {
            EventHandler<MailEventArgs> handler = Sending;

            if (handler != null)
            {
                handler(sender, e);
            }
        }
Exemplo n.º 3
0
        public UserAccountCreatedEvent(UserAccountId id, string userName, EMail email)
        {
            Condition.Requires(id, "id").IsNotNull();
              Condition.Requires(userName, "userName").IsNotNull();
              Condition.Requires(email, "email").IsNotNull();

              Id = id;
              UserName = userName;
              EMail = email;
        }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            ChatUser cu = obj as ChatUser;

            if ((object)cu == null)
            {
                return(false);
            }

            return((EMail?.Equals(cu?.EMail) ?? false) && IsGuest.Equals(cu?.IsGuest));
        }
Exemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + FirstName.GetHashCode();
            hash = hash * 23 + LastName.GetHashCode();
            hash = hash * 23 + UserName.GetHashCode();
            hash = hash * 23 + EMail.GetHashCode();

            return(hash);
        }
Exemplo n.º 6
0
        private EMail GetMailStruct(string displayName, string address, string type)
        {
            EMail result = new EMail();

            //if no valid mail data exit without calc
            if ((type ?? "") == "")
            {
                return(result);
            }

            result.Title   = displayName;
            result.Address = null;

            //if SMTP-address is given
            if (type.ToUpper() == "SMTP")
            {
                result.Address = address;
            }
            //if EXCHANGE-address
            else if (type.ToUpper() == "EX")
            {
                Microsoft.Office.Interop.Outlook.MailItem tmpMail = null;
                try
                {
                    tmpMail    = mAPI.Application.CreateItem(OutlookInterop.OlItemType.olMailItem);
                    tmpMail.To = address;
                    if (tmpMail.Recipients.ResolveAll())
                    {
                        foreach (OutlookInterop.Recipient tmpRcip in tmpMail.Recipients)
                        {
                            OutlookInterop.ExchangeUser exchangeUser = tmpRcip.AddressEntry.GetExchangeUser();
                            if (exchangeUser != null)
                            {
                                result.Address = exchangeUser.PrimarySmtpAddress;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("ERROR GetMailStruct " + e.Message);
                }
                finally
                {
                    if (tmpMail != null)
                    {
                        tmpMail.Close(OutlookInterop.OlInspectorClose.olDiscard);
                    }
                    tmpMail = null;
                }
            }

            return(result);
        }
Exemplo n.º 7
0
 public void SaveChanges()
 {
     using (var ctx = new FUTAccountsDatabase())
     {
         var pre = ctx.FUTAccounts.FirstOrDefault(x => x.EMail.ToLower() == EMail.ToLower());
         if (pre != null)
         {
             ctx.Entry(pre).CurrentValues.SetValues(this);
             ctx.SaveChanges();
         }
     }
 }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (OtherDescription?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (IntermediaryType?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Company?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EMail?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (GUID?.GetHashCode() ?? 0);
            return(hashCode);
        }
Exemplo n.º 9
0
        private void SendEmail(string subject, string body)
        {
            _sender = new User("Edvinas", "*****@*****.**")
            {
                Password = "******"
            };
            _receiver   = new User("You", "*****@*****.**");
            _mailClient = new GoogleMailClient();
            _eMail      = new EMail(subject, body);

            EMailSender.Send(_sender, _receiver, _eMail, _mailClient);
        }
Exemplo n.º 10
0
        public bool SetPersonIDByEmail(CStat.Models.CStatContext context)
        {
            var           lcEMail = !string.IsNullOrEmpty(EMail) ? EMail.ToLower() : "EMPTY";
            List <Person> pList   = context.Person.Where(p => !string.IsNullOrEmpty(p.Email) && lcEMail == p.Email.ToLower()).ToList <Person>();

            if (pList.Count == 1)
            {
                pid = pList[0].Id;
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        protected override bool internal_addMail(string mail)
        {
            if (_item.Emails.Where(m => m.Address.Equals(mail)).Count() > 0)
            {
                return(false);
            }
            //System.Windows.Forms.MessageBox.Show("Adding " + mail + " as an email address for " + this.ToString() + ".");
            EMail theMail = new EMail(mail, ContactsRelationships.IsOther);

            _item.Emails.Add(theMail);
            return(true);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Enqueue e-mail into the queue
 /// </summary>
 /// <param name="mail">E-Mail to be enqueued</param>
 public void Enqueue(EMail mail)
 {
     if (mail.Id > 0)
     {
         _dbContext.Entry(mail).State = EntityState.Modified;
     }
     else
     {
         _dbContext.Set <EMail>().Add(mail);
     }
     _dbContext.SaveChanges();
 }
        /// <summary>
        ///     Send RfQ, mail subject and body from mail template
        /// </summary>
        /// <returns>true if RfQ is sent per email.</returns>
        public bool SendRfQ()
        {
            try
            {
                MUser     to     = MUser.Get(GetCtx(), GetAD_User_ID());
                MClient   client = MClient.Get(GetCtx());
                MMailText mtext  = new MMailText(GetCtx(), GetRfQ().GetR_MailText_ID(), Get_TrxName());

                if (to.Get_ID() == 0 || to.GetEMail() == null || to.GetEMail().Length == 0)
                {
                    log.Log(Level.SEVERE, "No User or no EMail - " + to);
                    return(false);
                }

                // Check if mail template is set for RfQ window, if not then get from RfQ Topic window.
                if (mtext.GetR_MailText_ID() == 0)
                {
                    MRfQTopic mRfQTopic = new MRfQTopic(GetCtx(), GetRfQ().GetC_RfQ_Topic_ID(), Get_TrxName());
                    if (mRfQTopic.GetC_RfQ_Topic_ID() > 0)
                    {
                        mtext = new MMailText(GetCtx(), mRfQTopic.GetR_MailText_ID(), Get_TrxName());
                    }
                }

                //Replace the email template constants with tables values.
                StringBuilder message = new StringBuilder();
                mtext.SetPO(GetRfQ(), true);
                message.Append(mtext.GetMailText(true).Equals(string.Empty) ? "** No Email Body" : mtext.GetMailText(true));

                String subject = String.IsNullOrEmpty(mtext.GetMailHeader()) ? "** No Subject" : mtext.GetMailHeader();;

                EMail email = client.CreateEMail(to.GetEMail(), to.GetName(), subject, message.ToString());
                if (email == null)
                {
                    return(false);
                }
                email.AddAttachment(CreatePDF());
                if (EMail.SENT_OK.Equals(email.Send()))
                {
                    //SetDateInvited(new Timestamp(System.currentTimeMillis()));
                    SetDateInvited(DateTime.Now);
                    Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                log.Severe(ex.ToString());
                //MessageBox.Show("error--" + ex.ToString());
            }
            return(false);
        }
Exemplo n.º 14
0
        }       //	doIt

        /// <summary>
        /// Send No Guarantee EMail
        /// </summary>
        /// <param name="A_Asset_ID">asset</param>
        /// <param name="R_MailText_ID">mail to send</param>
        /// <param name="trxName">trx</param>
        /// <returns>message - delivery errors start with **</returns>
        private String SendNoGuaranteeMail(int A_Asset_ID, int R_MailText_ID, Trx trxName)
        {
            MAsset asset = new MAsset(GetCtx(), A_Asset_ID, trxName);

            if (asset.GetAD_User_ID() == 0)
            {
                return("** No Asset User");
            }
            VAdvantage.Model.MUser user = new VAdvantage.Model.MUser(GetCtx(), asset.GetAD_User_ID(), Get_Trx());
            if (user.GetEMail() == null || user.GetEMail().Length == 0)
            {
                return("** No Asset User Email");
            }
            if (_MailText == null || _MailText.GetR_MailText_ID() != R_MailText_ID)
            {
                _MailText = new VAdvantage.Model.MMailText(GetCtx(), R_MailText_ID, Get_Trx());
            }
            if (_MailText.GetMailHeader() == null || _MailText.GetMailHeader().Length == 0)
            {
                return("** No Subject");
            }

            //	Create Mail
            EMail email = _client.CreateEMail(user.GetEMail(), user.GetName(), null, null);

            if (email == null)
            {
                return("** Invalid: " + user.GetEMail());
            }
            _MailText.SetPO(user);
            _MailText.SetPO(asset);
            String message = _MailText.GetMailText(true);

            if (_MailText.IsHtml())
            {
                email.SetMessageHTML(_MailText.GetMailHeader(), message);
            }
            else
            {
                email.SetSubject(_MailText.GetMailHeader());
                email.SetMessageText(message);
            }
            String msg = email.Send();

            new MUserMail(_MailText, asset.GetAD_User_ID(), email).Save();
            if (!EMail.SENT_OK.Equals(msg))
            {
                return("** Not delivered: " + user.GetEMail() + " - " + msg);
            }
            //
            return(user.GetEMail());
        }       //	sendNoGuaranteeMail
Exemplo n.º 15
0
        protected override void Execute(CodeActivityContext context)
        {
            var email    = EMail.Get(context);
            var filename = Filename.Get(context);
            var folder   = Folder.Get(context);
            var astype   = Type.Get(context);

            if (!string.IsNullOrEmpty(folder))
            {
                filename = System.IO.Path.Combine(folder, RemoveInvalidChars(email.Subject));
                switch (astype)
                {
                case "4":
                    filename += ".doc"; break;

                case "5":
                    filename += ".html"; break;

                case "8":
                    filename += ".ics"; break;

                case "10":
                    filename += ".mht"; break;

                case "3":
                    filename += ".msg"; break;

                case "9":
                    filename += ".msg"; break;

                case "1":
                    filename += ".rtf"; break;

                case "2":
                    filename += ".oft"; break;

                case "0":
                    filename += ".txt"; break;

                case "7":
                    filename += ".vcs"; break;

                case "6":
                    filename += ".vcf"; break;
                }
            }
            email.mailItem.SaveAs(filename, astype); // olMSGUnicode / msg : 9    olMSG / msg : 3
            if (!string.IsNullOrEmpty(folder))
            {
                Filename.Set(context, filename);
            }
        }
        public ICommandResult Handle(CreatePaypalSubscriptionCommand command)
        {
            // Verificar se o documento está cadastrado.
            if (_repository.DocumentExists(command.Document))
            {
                AddNotification("Document", "Este CPF já está em uso.");
            }

            // Verificar se o email está cadastrado.
            if (_repository.DocumentExists(command.EMail))
            {
                AddNotification("EMail", "Este e-mail já está em uso.");
            }

            // Gerar os VO's
            var name     = new Name(command.FirstName, command.LastName);
            var document = new Document(command.Document, EDocumentType.CPF);
            var eMail    = new EMail(command.EMail);
            var address  = new Address(command.Street, command.Number, command.Neighborhood, command.City, command.Street, command.Country, command.Zip);

            // Gerar as entidades
            var student      = new Student(name, document, eMail);
            var subscription = new Subscription(DateTime.Now.AddMonths(1));
            var payment      = new PayPalPayment(
                command.TransactionCode,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                address,
                command.Payer,
                //document,
                new Document(command.PayerDocument, command.PayerDocumentType),
                eMail);

            // Relacionamentos
            subscription.AddPayment(payment);
            student.AddSubscription(subscription);


            // Agrupar as validações
            AddNotifications(name, document, eMail, address, student, subscription, payment);

            // Salvar as informações
            _repository.CreateSubscription(student);

            // Enviar email de boas vindas
            _emailService.Send(student.Name.ToString(), student.EMail.Address, "Bem Vindo", "Sua assinatura foi criada.");

            // Retornar as informações
            return(new CommandResult(true, "Assinatura realizada com sucesso."));
        }
Exemplo n.º 17
0
        private EMail BuildEMail()
        {
            var eMail = new EMail();

            eMail.Id              = 1;
            eMail.EMailType       = new EMailType();
            eMail.EMailAddress    = "*****@*****.**";
            eMail.LastUpdatedBy   = "edm";
            eMail.LastUpdatedDate = DateTime.Now;
            eMail.Notes           = "notes for doctype";

            return(eMail);
        }
Exemplo n.º 18
0
        public void Send(EMail mail)
        {
            OnSending(mail, new MailEventArgs(mail));

            try
            {
                // Send mail...
            }
            catch (Exception ex)
            {
                // Error log...
            }
        }
        private EMailRM CreateEMailForAssociate(Commands.V1.Associate.EMail.CreateForAssociate cmd)
        {
            EMail email = EMail.CreateForAssociate(_emails++, EMailAddress.Create(cmd.EMailAddress), cmd.IsPrimary, cmd.AssociateId);

            if (_repository.EMailExistsForAssociate(email, cmd.AssociateId))
            {
                throw new InvalidOperationException($"EMail already exists for Associate {cmd.AssociateId}");
            }

            _repository.AddEMailForAssociate(email, cmd.AssociateId);

            return(Conversions.GetEMailRM(email));
        }
Exemplo n.º 20
0
        public ActionResult Index(string SName, string SEmail, string SSubject, string SMessage)

        {
            string SN = SName;
            string SE = SEmail;
            string SS = SSubject;
            string SM = SMessage;

            EMail omail = new EMail();

            omail.SendMail("FeedBack", "*****@*****.**", new string[] { SN, SE, SS, SM });
            return(View());
        }
Exemplo n.º 21
0
        public void FillFormSuccessfulReg(RegistrationUser user)
        {
            //everytime the email should be different
            //for successful registration
            string secondPartEmail = user.Email.Trim().Remove(0, user.Email.IndexOf('@'));
            string firstPartEmail  = Utils.RandomString(5);

            FullName.SendKeys(user.FullName);
            EMail.SendKeys(firstPartEmail + secondPartEmail);
            Password.SendKeys(user.Password);
            ConfirmPassword.SendKeys(user.ConfirmPassword);
            RegisterButton.Click();
        }
Exemplo n.º 22
0
        protected void lnkCadastrar_Click(object sender, EventArgs e)
        {
            if (IsAdmin)
            {
                DataKartDataContext dk      = new DataKartDataContext();
                Kart_Noticias_Grupo noticia = null;
                int idNoticia = Convert.ToInt32(HiddenFieldIdNoticia.Value);

                if (idNoticia <= 0)
                {
                    noticia = new Kart_Noticias_Grupo();
                }
                else
                {
                    noticia = (from n in dk.Kart_Noticias_Grupos
                               where n.idNoticias == idNoticia
                               select n).FirstOrDefault();
                }

                if (noticia == null)
                {
                    noticia = new Kart_Noticias_Grupo();
                }

                noticia.idGrupo   = IdGrupo;
                noticia.dtCriacao = DateTime.Now;
                noticia.Ativo     = true;
                noticia.IdUsuario = UsuarioLogado.idUsuario;
                noticia.Titulo    = txtTitulo.Text;
                noticia.Noticia   = textarea.Text;

                if (idNoticia <= 0)
                {
                    dk.Kart_Noticias_Grupos.InsertOnSubmit(noticia);
                }

                dk.SubmitChanges();
                popularNoticias();

                if (idNoticia <= 0 && noticia.idNoticias > 0)
                {
                    EMail.EnviarEmailNoticias(IdGrupo, noticia.idNoticias);
                }

                Alert("Operação efetuado com sucesso!");
            }
            else
            {
                Alert("Você não possue permissão para editar noticias deste grupo!");
            }
        }
Exemplo n.º 23
0
    protected void Commit_Click(object sender, EventArgs e)
    {
        IMyLog logUpgrade = MyLog.GetLogger("Upgrade");

        try
        {
            UpdateInfo priceInfo = getHardcodedPriceInfoOrGoBackToPricePage();

            int howManyNumbers = 0;
            int.TryParse(HowManyNumbers.SelectedItem.Value, out howManyNumbers);

            int howManyMessages = 0;
            int.TryParse(HowManyMessages.SelectedItem.Value, out howManyMessages);

            int howManyTopups = 0;
            int.TryParse(HowManyTopups.SelectedItem.Value, out howManyTopups);

            int fullpayment = 0;
            int.TryParse(FullPayment.SelectedItem.Value, out fullpayment);

            logUpgrade.Info("Commit");

            Data_AppUserWallet wal = Data_AppUserWallet.Create(
                sd.LoggedOnUserEmail,
                TitleId.Text,
                priceInfo.Info,
                priceInfo.Type,
                new AmountAndPrice(howManyNumbers, GetPrice(priceInfo.Number)),
                new AmountAndPrice(howManyMessages, GetPrice(priceInfo.Message)),
                new AmountAndPrice(howManyTopups, GetPrice(priceInfo.Month)),
                new AmountAndPrice(1, GetPrice(priceInfo.OneTimeSetup)),
                new AmountAndPrice(fullpayment, GetPrice(priceInfo.FullPayment)));

            string emailBody = wal.GetEmailBody(sd.LoggedOnUserName, sd.LoggedOnUserEmail);

            bool alreadyThere;
            DSSwitch.appWallet().StoreNew(wal, out alreadyThere, logUpgrade);

            EMail.SendGeneralEmail(sd.LoggedOnUserEmail, true, wal.Title, emailBody, new LogForEmailSend(MyLog.GetLogger("Email")));

            showStoredData(wal);
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
        catch (Exception ex)
        {
            logUpgrade.Debug(ex.Message);
        }
    }
Exemplo n.º 24
0
        public async Task <ActionResult> UpdateStatuAsync(int id)
        {
            Utilisateur ut = db.Utilisateur.Find(id);

            ut.Statu = !ut.Statu.Value;
            db.Utilisateur.Attach(ut);
            db.Entry(ut).State = EntityState.Modified;
            await db.SaveChangesAsync();

            AspNetUsers user = db.AspNetUsers.FirstOrDefault(a => a.Email == ut.Email);

            if (user != null)
            {
                user.EmailConfirmed = ut.Statu.Value;
            }
            db.AspNetUsers.Attach(user);
            db.Entry(user).State = EntityState.Modified;
            await db.SaveChangesAsync();

            //// Send Password in Gmail///////////
            string recipient = ut.Email;
            string body      = "";
            string subject   = "MEF Espace";

            if (ut.Statu.Value)
            {
                body = "Bonjour,<br>Merci pour l'intérêt que vous témoignez envers l'espace MEF Maroc.<br> <strong> Votre Compte Est Activé</strong>.Vous pourrez accéder à votre espace en tant que Bailleurs de Fonds .Pour cela, vous devrez utiliser votre email : " + ut.Email + " comme login Votre compte vous donne accès aux fonctionnalités réservées aux participants à  l'espace MEF<br> Vous pourrez à tout moment modifier votre mot de passe  à partir de votre espace personnel.<br> Pour tout besoin,<br> vous pouvez nous contacter via l'email suivant: [email protected]";
            }
            else
            {
                body = "Votre Compte est Désactivé";
            }
            EMail           sm      = new EMail();
            IdentityMessage message = new IdentityMessage();

            message.Subject     = subject;
            message.Body        = body;
            message.Destination = recipient;
            await sm.configSendGridasync(message);

            //WebMail.SmtpServer = "smtp.gmail.com";
            //WebMail.SmtpPort = 587;

            //WebMail.SmtpUseDefaultCredentials = false;
            //WebMail.EnableSsl = true;
            //WebMail.UserName = "******";
            //WebMail.Password = "******";
            //WebMail.Send(to: recipient, subject: subject, body: body, isBodyHtml: true);
            ///////////////////////////////
            return(RedirectToAction("Index"));
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            try
            {
                // create an OAuth factory to use
                GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("cl", "MyApp");
                requestFactory.ConsumerKey    = "CONSUMER_KEY";
                requestFactory.ConsumerSecret = "CONSUMER_SECRET";

                // example of performing a query (use OAuthUri or query.OAuthRequestorId)
                Uri calendarUri = new OAuthUri("http://www.google.com/calendar/feeds/default/owncalendars/full", "USER", "DOMAIN");
                // can use plain Uri if setting OAuthRequestorId in the query
                // Uri calendarUri = new Uri("http://www.google.com/calendar/feeds/default/owncalendars/full");

                CalendarQuery query = new CalendarQuery();
                query.Uri = calendarUri;
                query.OAuthRequestorId = "USER@DOMAIN"; // can do this instead of using OAuthUri for queries

                CalendarService service = new CalendarService("MyApp");
                service.RequestFactory = requestFactory;
                service.Query(query);
                Console.WriteLine("Query Success!");

                // example with insert (must use OAuthUri)
                Uri contactsUri = new OAuthUri("http://www.google.com/m8/feeds/contacts/default/full", "USER", "DOMAIN");

                ContactEntry entry        = new ContactEntry();
                EMail        primaryEmail = new EMail("*****@*****.**");
                primaryEmail.Primary = true;
                primaryEmail.Rel     = ContactsRelationships.IsHome;
                entry.Emails.Add(primaryEmail);

                ContactsService contactsService = new ContactsService("MyApp");
                contactsService.RequestFactory = requestFactory;
                contactsService.Insert(contactsUri, entry); // this could throw if contact exists

                Console.WriteLine("Insert Success!");

                // to perform a batch use
                // service.Batch(batchFeed, new OAuthUri(atomFeed.Batch, userName, domain));

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fail!");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                Console.ReadKey();
            }
        }
Exemplo n.º 26
0
        public ActionResult SendMail(string id_dg, string ngay_tra)
        {
            var viewResult = ViewMS() as ActionResult;
            //if (viewResult != null)
            //{
            //    viewResult.ViewName = "~/Views/Home/Contact.cshtml";
            //}
            var   dg    = (from d in data.DOCGIA where d.MS_THE == id_dg select d).First();
            EMail oMail = new EMail();

            oMail.SendMail("Email", dg.EMAIL, new String[] { "Nhắc Nhở Trả Sách Thư Viện ĐH Khoa Học Tự Nhiên", "Chào bạn, hệ thống thư viện nhắc nhở bạn ngày " + ngay_tra + " là đến hạn trả sách mà bạn đang mượn vui lòng thực hiện đúng như yêu cầu. Cám ơn" });

            return(viewResult);
        }
Exemplo n.º 27
0
        public void SendNotification()
        {
            if (DateTime.Today.Day != SEND_DAY)
            {
                return;
            }

            DiagCardList    diagCardList = DiagCardList.getInstance();
            List <DiagCard> list         = diagCardList.GetDiagCardEnds().ToList();

            int begin = 0;
            int end   = 0;

            if (!ListEmpty(list))
            {
                STSList stsList = STSList.getInstance();

                while (end < list.Count)
                {
                    begin = end;
                    end  += ((end + MAILS_COUNT) < list.Count) ? MAILS_COUNT : (list.Count - end);

                    List <DiagCard> listCut = new List <DiagCard>();

                    for (int i = begin; i < end; i++)
                    {
                        listCut.Add(list[i]);
                    }

                    IEnumerable <Car> carList = diagCardList.GetCarListFromDiagCardList(listCut);
                    List <string>     files   = new List <string>();

                    foreach (Car car in carList)
                    {
                        STS sts = stsList.getItem(car);
                        if (sts.File != string.Empty)
                        {
                            files.Add(sts.File);
                        }
                    }

                    string mailText = CreateMail(listCut);

                    EMail email = new EMail();

                    Driver employeeAutoDept = GetDriverForSending();
                    email.SendNotification(employeeAutoDept, mailText, true, files);
                }
            }
        }
Exemplo n.º 28
0
        protected void SendForgotPasswordMail(ApplicationUser user, string url)
        {
            var sendFrom = ConfigurationManager.AppSettings["ForgotPasswordMailFrom"];
            var sendTo   = user.Email;
            var subject  = ConfigurationManager.AppSettings["ForgotPasswordMailSubject"];
            var body     = ConfigurationManager.AppSettings["ForgotPasswordMailBody"];

            body = body.Replace("$first_name$", user.FirstName);
            body = body.Replace("$last_name$", user.LastName);
            body = body.Replace("$URL$", url);
            body = body.Replace("$user_id$", user.UserName);
            body = body.Replace("$systemAdmin_mailId$", ConfigurationManager.AppSettings["systemAdminMailId"]);
            EMail.SendMail(sendFrom, sendTo, subject, body);
        }
Exemplo n.º 29
0
        public void SendNotification()
        {
            string message = CreateMessageNotification();

            EMail email = new EMail();

            email.SendNotification(Driver, message);

            IsNotificationSent = true;
            if (ID != 0)
            {
                ExecSave();
            }
        }
Exemplo n.º 30
0
        // SMTP Logging...

        #region LogError(ServerTimestamp, EMail, Response, Error = null, LastException = null)

        /// <summary>
        /// Log an error during request processing.
        /// </summary>
        /// <param name="ServerTimestamp">The timestamp of the incoming request.</param>
        /// <param name="EMail">The incoming request.</param>
        /// <param name="HTTPResponse">The outgoing response.</param>
        /// <param name="Error">The occured error.</param>
        /// <param name="LastException">The last occured exception.</param>
        public void LogError(DateTime ServerTimestamp,
                             String SMTPCommand,
                             EMail EMail,
                             SMTPExtendedResponse Response,
                             String Error            = null,
                             Exception LastException = null)
        {
            var ErrorLogLocal = ErrorLog;

            if (ErrorLogLocal != null)
            {
                ErrorLogLocal(this, ServerTimestamp, SMTPCommand, EMail, Response, Error, LastException);
            }
        }
Exemplo n.º 31
0
        public void Send(EMail mail)
        {
            OnSending(mail, new MailEventArgs(mail));

            try
            {
                // Send mail...

            }
            catch (Exception ex)
            {
                // Error log...
            }
        }
        private EMail BuildEMail()
        {
            var eMail = new EMail()
            {
                Id              = 1,
                EMailType       = new EMailType(),
                EMailAddress    = "*****@*****.**",
                LastUpdatedBy   = "edm",
                LastUpdatedDate = DateTime.Now,
                Notes           = "notes for doctype"
            };

            return(eMail);
        }
Exemplo n.º 33
0
 //
 /// <summary>
 /// Email service handler send async method ...
 /// </summary>
 /// <param name="message">
 /// Email message is as follows:
 ///  <list type="bullet">
 ///   <item><description>Destination, i.e. To email, or SMS phone number,</description></item>
 ///   <item><description>Subject,</description></item>
 ///   <item><description>Message contents.</description></item>
 ///  </list>
 /// </param>
 /// <returns></returns>
 public Task SendAsync(IdentityMessage message)
 {
     // Email service here to send an email.
     //    <add key="Email:Enabled" value="true" />
     if (NSG.Library.Helpers.Config.GetBoolAppSettingConfigValue("Email:Enabled", false))
     {
         string _from  = NSG.Library.Helpers.Config.GetStringAppSettingConfigValue("Email:FromEmailName", "");
         IEMail _email =
             new EMail(Log.Logger, _from, message.Destination, message.Subject, message.Body)
             .Html(true).SendAsync();
         return(Task.FromResult(0));
     }
     return(Task.FromResult(100));
 }
Exemplo n.º 34
0
        public void CanSerialize()
        {
            IFormatter formatter = new BinaryFormatter();
              EMail p1 = new EMail("qqq@www");
              using (MemoryStream s = new MemoryStream())
              {
            formatter.Serialize(s, p1);
            s.Seek(0, SeekOrigin.Begin);

            EMail p2 = (EMail)formatter.Deserialize(s);

            Assert.AreEqual(p1, p2);
              }
        }
Exemplo n.º 35
0
    private bool HitDangerKey(EMail email, char keyPressed)
    {
        char[] keyToLower = keyPressed.ToString().ToLower().ToCharArray();
        keyPressed = keyToLower[0];

        for (int i = 0; i < email.dangerKeys.Length; i++)
        {
            if (email.dangerKeys[i] == keyPressed)
            {
                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 36
0
        public void ShouldSendEmail()
        {
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add("*****@*****.**");
            mail.Subject = "Test Mail" + DateTime.Now.ToString("hh:mm:ss");
            mail.Body = "This is for testing SMTP mail";

            EMail eMail = new EMail();

            var events = eMail.SendEmail(mail);

            // wait for all emails to signal
            WaitHandle.WaitAll(events.ToArray());
               //
        }
Exemplo n.º 37
0
        public void ShouldSendEmailAsync()
        {
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add("*****@*****.**");
            mail.Subject = "Test Mail" + DateTime.Now.ToString("hh:mm:ss");
            mail.Body = "This is for testing SMTP mail";

            EMail eMail = new EMail();

            var ret= eMail.SendEmailAsync(mail);

            // wait for all emails to signal
            //
            while(!ret.IsCompleted)
            {}
        }
Exemplo n.º 38
0
        public ActionResult ForgottenPassword(LogOnModel logOnModel)
        {
            try
            {

                var currentUser = Membership.GetUser(logOnModel.UserName);

                if (currentUser != null)
                {

                    var password = currentUser.ResetPassword();

                    var emailSender = new EMail();

                    var body = string.Format("Hi {0}!\r\nYour new password is {1}", currentUser.UserName, password);

                    var mailMessage = new MailMessage("*****@*****.**", currentUser.Email, "ArtSite details",
                                                              body);
                    var result = emailSender.SendEmailAsync(mailMessage);

                    return RedirectToAction("PassWordSent", new { emailAddress = currentUser.Email });

                }
                else
                {
                    ModelState.AddModelError("", string.Format("'{0}' is not registered", logOnModel.Email));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.ToString());

            }
            return View();
        }
Exemplo n.º 39
0
 public MailEventArgs(EMail mail)
 {
 }
Exemplo n.º 40
0
        public static void UserLoginByTicket(EMail.IncidentUserTicket ticket)
        {
            UserLight user = UserLight.Load(ticket.UserId);

            SetCurrentUser(user);
        }
Exemplo n.º 41
0
        public ActionResult SendEmail(EMailView model, string returnUrl)
        {
            if (ModelState.IsValid)
            {

                EMail eMail = new EMail();
                try
                {
                    //make sure to address is ok (as this set by system not user)
                    Regex regex = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
                    if (model.LogOnModel.Email == null)
                    {
                        ModelState.AddModelError("", "The 'To' address is blank");

                    }
                    else
                    {

                        var match = regex.Match(model.LogOnModel.Email);
                        if (match.Success)
                        {
                            string message = string.Format("<p>Message from {0}</p></br>{1}", model.EmailFrom, model.Message);

                            eMail.SendEmailAsync(new MailMessage(EMail.UserName, model.LogOnModel.Email,
                                              "Do Not Reply - Art1st site contact from " + model.EmailFrom, message));

                        }
                        else
                        {
                            //log message sent
                            string message = string.Format("{0} \n from {1}", model.Message, model.EmailFrom);

                            Logger.Error("Failed to send email to " + model.LogOnModel.UserName, null);
                            EMail.SendEmailToAdministrator("Failed to send email to " + model.LogOnModel.UserName,
                                                           message);
                        }
                        //do stuff
                        if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                            && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                        {
                            return Redirect(returnUrl);
                        }
                        else
                        {
                            return RedirectToAction("Index", "Home");
                        }
                    }
                }
                catch(FormatException ex)
                {
                    ModelState.AddModelError("", "Please enter a valid email address");
                }
                catch (Exception ex)
                {
                    Logger.Error("Error in sendEmail", ex);
                    ModelState.AddModelError("", ex.ToString());
                }

            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Exemplo n.º 42
0
 public void CanCreateAndDisplayEMail()
 {
     EMail e1 = new EMail("*****@*****.**");
       Assert.AreEqual("*****@*****.**", e1.ToString());
 }