Exemple #1
0
        private async void btnPosalji_Click(object sender, EventArgs e)
        {
            if (Validacija())
            {
                MessageBox.Show("Morate unijeti tekst poruke.", "Info", MessageBoxButtons.OK);
            }
            else
            {
                SmtpClient client = new SmtpClient("smtp.office365.com", 587);


                NetworkCredential cred = new NetworkCredential("*****@*****.**", "Programiranje2016");

                //To send an email we must first create a new mailMessage(an email) to send.
                MailMessage Msg = new MailMessage();

                // Sender e-mail address.
                Msg.From = new MailAddress("*****@*****.**");//Nothing But Above Credentials or your credentials (*******@gmail.com)

                // Recipient e-mail address.
                Msg.To.Add("*****@*****.**");

                // Assign the subject of our message.
                Msg.Subject = txtNaslov.Text + " - " + Global.prijavljeniKorisnik.KorisnickoIme;

                // Create the content(body) of our message.
                Msg.Body = txtMail.Text;

                // Send our account login details to the client.
                client.Credentials = cred;

                //Enabling SSL(Secure Sockets Layer, encyription) is reqiured by most email providers to send mail
                client.EnableSsl = true;

                //Confirmation After Click the Button
                //label5.Text = "Mail Sended Succesfully";

                // Send our email.
                client.Send(Msg);


                ErrorLogUpsertRequest model = new ErrorLogUpsertRequest();

                model.ErrorPoruka = txtMail.Text;
                model.KorisnikId  = Global.prijavljeniKorisnik.KorisnikId;
                model.Datum       = DateTime.Now;


                var nesto = await _errorLog.Insert <Model.ErrorLog>(model);

                MessageBox.Show("Uspjesno ste prijavili gresku.", "Info", MessageBoxButtons.OK);
                this.Close();
            }
        }
Exemple #2
0
        public override Model.ErrorLog Insert(ErrorLogUpsertRequest request)
        {
            ErrorLog error = new ErrorLog();

            error.ErrorPoruka = request.ErrorPoruka;
            error.Datum       = request.Datum;
            error.KorisnikId  = request.KorisnikId;

            _db.ErrorLog.Add(error);
            _db.SaveChanges();

            return(_mapper.Map <Model.ErrorLog>(error));
        }