// GET: EmailSetup public ActionResult Index(int id) { Livre livre = ((SQLRepositoryLivre)contextLivre).FindMailByBook(id); gmail gmail = new gmail() { To = livre.Client.Email }; return(View(gmail)); }
public void UploadAndPost() { FileCommonUtil fcu = new FileCommonUtil(); string fileFullPath = fcu.CheckAttachmentKeyAndReturnFullFilePath();//첨부파일 1개기준 if (string.IsNullOrEmpty(fileFullPath)) { return; } gmail mensagem = new gmail(); mensagem.auth("*****@*****.**", "lee1004"); //1)web.config포함 -> 2)cms관리 포함 mensagem.fromAlias = "kesso.kr"; //1)web.config포함 -> 2)cms관리 포함 mensagem.To = "*****@*****.**"; //1)web.config포함 -> 2)cms관리 포함 mensagem.Message = ""; mensagem.Priority = 0; mensagem.Html = false; mensagem.Subject = this.MESSAGE;//"@ks2colorworld test 한글2 "; mensagem.attach(fileFullPath); /* * if (!string.IsNullOrEmpty(this.ATTACHMENT_KEY))//attachment_key * { * FileCommonUtil fcu = new FileCommonUtil(); * mensagem.attach(fcu.ReturnFileFullPath(this.ATTACHMENT_KEY)); * //mensagem.attach(@"C:\_WAS\1_service_kesso_kr\upload\photoservice\-\photoservice_20100830121937.jpg"); * } */ //mensagem.zip("nomedoficheiro.zip", "password"); bool success = mensagem.send(); if (!success) { //추후 error로그 저장 후 메시지 전송할 것. #if FOR_TEST xmlCommonUtil.ResponseWriteErrorMSG("UpdateTwitPic Fail!!(" + fileFullPath + ")"); #else xmlCommonUtil.ResponseWriteErrorMSG("UpdateTwitPic Fail!!"); #endif return; } //추후 로그 저장 후 메시지 전송할 것. #if FOR_TEST xmlCommonUtil.ResponseWriteMSG("1", "UpdateTwitPic Success!!(" + fileFullPath + ")"); #else xmlCommonUtil.ResponseWriteMSG("1", "UpdateTwitPic Success!!"); #endif }
public void SendMailWithUiPath(string username, string password, string subject, string message, string[] to, string[] cc) { gmail gmail = new gmail(); gmail.auth(username, password); gmail.Subject = subject; gmail.Message = message; foreach (string t in to) { gmail.To = t; } foreach (string c in cc) { gmail.Cc = c; } gmail.send(); }
public async Task <IActionResult> Registration(UserOfProgram patient, gmail model) { if (ModelState.IsValid) { var user = new UserOfProgram { UserName = patient.Email, Email = patient.Email }; var result = await _userManager.CreateAsync(user, patient.PasswordHash); string ctoken = _userManager.GenerateEmailConfirmationTokenAsync(user).Result; string ctokenlink = Url.Action("ConfirmEmail", "Account", new { userid = user.Id, token = ctoken }, protocol: HttpContext.Request.Scheme); ViewBag.token = ctokenlink; Random rnd = new Random(); int activationCode = rnd.Next(100000, 999999); model.ToWho = patient.Email; MailMessage mm = new MailMessage("*****@*****.**", model.ToWho); mm.Subject = "Aktywacja konta w serwisie Szymon"; mm.Body = $"Dziękujemy za zarejstorwanie się w naszym serwisie, twój kod aktywacyjny to {activationCode}"; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential("*****@*****.**", "MvcJestSuper"); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); ViewBag.Activation = activationCode; ViewBag.Message = "Mail has been sent successfully!"; return(View(patient)); } else { return(View()); } }
public async Task <IActionResult> Registration(Patients patient, gmail model) { var result = await mUserManager.CreateAsync(new Patients { UserName = patient.UserName, Email = patient.Email }, patient.PasswordHash); if (ModelState.IsValid) { if (result.Succeeded) { return(View("WriteCode", patient)); } //Random rnd = new Random(); //int activationCode = rnd.Next(100000, 999999); //model.ToWho = patient.Email; //MailMessage mm = new MailMessage("*****@*****.**", model.ToWho); //mm.Subject = "Aktywacja konta w serwisie Szymon"; //mm.Body = $"Dziękujemy za zarejstorwanie się w naszym serwisie, twój kod aktywacyjny to {activationCode}"; //mm.IsBodyHtml = false; //SmtpClient smtp = new SmtpClient(); //smtp.Host = "smtp.gmail.com"; //smtp.Port = 587; //smtp.EnableSsl = true; //NetworkCredential nc = new NetworkCredential("*****@*****.**", "MvcJestSuper"); //smtp.UseDefaultCredentials = true; //smtp.Credentials = nc; //smtp.Send(mm); //ViewBag.Activation = activationCode; //ViewBag.Message = "Mail has been sent successfully!"; return(View()); } else { return(View()); } }
public ActionResult SendMessage(gmail model, int?subjectId, int?schoolKidId) { if (!isAuthenticate()) { return(Redirect("/Admin/LoginPage/?error")); } MailMessage mm = new MailMessage("*****@*****.**", model.To); mm.Subject = model.Subject; mm.Body = model.Body; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential networkCredential = new NetworkCredential("*****@*****.**", "kundelik2020csharp"); smtp.UseDefaultCredentials = true; smtp.Credentials = networkCredential; smtp.Send(mm); IQueryable <Parent> parents = db.Parents; IQueryable <Subject> subjects = db.Subjects.Include(s => s.Group); IQueryable <SchoolKid> schoolKids = db.SchoolKids.Include(s => s.Group); Subject subject = subjects.First(s => s.Id == subjectId); SchoolKid schoolKid = schoolKids.First(s => s.Id == schoolKidId); IQueryable <Grade> grades = db.Grades.Include(g => g.SchoolKid).Include(g => g.Subject); grades = grades.Where(g => g.SchoolKidId == schoolKidId); grades = grades.Where(g => g.SubjectId == subjectId); ViewBag.subject = subject; ViewBag.schoolKid = schoolKid; ViewBag.Message = "Mail Has Been Sent Succesfully!"; return(View()); }
public IActionResult Contact(gmail model) { MailMessage mm = new MailMessage(model.From, "*****@*****.**"); mm.Subject = model.Subject; mm.Body = model.Body; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential(model.From, model.Password); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); return(View()); }
public ActionResult Index(gmail model) { MailMessage mm = new MailMessage("*****@*****.**", model.To); mm.Subject = model.Subject; mm.Body = model.Body; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential("*****@*****.**", "mvpnlwj@testTrocMailBox"); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); ViewBag.Message = "Mail has been sent successfully"; return(RedirectToAction("Index", "Home")); }
public ActionResult decline(gmail model, Student student) { MailMessage mm = new MailMessage("*****@*****.**", "*****@*****.**"); mm.Subject = "Application Declined for Durban Girls High"; mm.Body = "Dear student your application was unsuccessful. "; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential("*****@*****.**", "dgss1234#"); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); return(RedirectToAction("Index", "Students")); }
public ActionResult Gmail(gmail gm) { MailMessage mm = new MailMessage(gm.From, gm.To); mm.Subject = gm.Subject; mm.Body = gm.Body; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential("*****@*****.**", "Redminote8"); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); ViewBag.Message = "<script>alert('Mail Has Been Sent Sucessfully')</script>"; ModelState.Clear(); return(View());; }
public ActionResult Index(gmail model) { info = Session["userData"] as User; if (info != null) { if (info.user_types_id == 1) { #region /* * model.from > ايميل الراسل * model.to > ايميل اللى رايحاله الرسالة * model.pass > الباسورد بتاع الراسل"اللى باعت الميل"ــ */ MailMessage mm = new MailMessage(model.from, model.to); mm.Subject = model.subject; mm.Body = model.body; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential(model.from, model.pass); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); ViewBag.msg = "Email has been sended !"; return(View()); } else { return(RedirectToAction("page_error_400", "Dashboard")); } } else { return(RedirectToAction("page_error_400", "Dashboard")); } }
public ActionResult SendEmail(gmail model) { MailMessage mm = new MailMessage("[email protected] ", "*****@*****.**"); mm.Subject = "Feedback / Question"; mm.Body = model.Body; mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; NetworkCredential nc = new NetworkCredential("*****@*****.**", "Feedback@schools"); smtp.UseDefaultCredentials = true; smtp.Credentials = nc; smtp.Send(mm); ViewBag.Message = "your Feedback / Question has been sent succefully"; return(View()); }
protected void bSalva_Click(object sender, EventArgs e) { Session.Timeout = 70; Int32 idu = Session["iduser"] != null?Int32.Parse(Session["iduser"].ToString()) : -1; if (idu < 0) { Stato("ATTENZIONE: sessione scaduta. Ricollegarsi.", Color.Red); return; } utenti.cercaid(idu); // nonso perchè mi cerco ??? Int32 userid = -1; Int32.TryParse(dgvComm.SelectedValue != null ? dgvComm.SelectedValue.ToString() : "", out userid); // mi prendo l'id dell'utente da abilitare dettutente.cercaid(userid); dettutente.abilitato = cbAbilitato.Checked; dettutente.potere = int.Parse(ddlPotere.SelectedValue); dettutente.limite = cldLimite.SelectedDate; if (userid >= 0) { if (!dettutente.registradatiutente("registrazioni", utenti.iduser)) { Stato("Modifica richiesta non andata a buon fine. Prego contattare servizio assistenza al n. " + Session["assistenza"].ToString(), Color.Red); return; } // ok inoltro la richiesta if (riabilitato == false && dettutente.abilitato == true) { gmail gm = new gmail(); gm.subject = "Abilitazione form richieste servizi Agenzia per gli Appalti e Contratti."; gm.body = "Buongiorno gentile " + dettutente.nome + " " + dettutente.cognome + "\n\n"; gm.body += " di seguito le credenziali per l'accesso all'applicazione riservata alla gestione delle richieste di servizi, rivolte all'APAC.\n\n"; gm.body += "Username\t" + dettutente.nikname + "\n"; gm.body += "Password\t" + dettutente.password + "\n\n\n"; gm.body += "Cordiali saluti.\n"; string[] achi = { dettutente.mail }; gm.achi = achi; string[] achiccn = { "*****@*****.**", "*****@*****.**" }; gm.achiccn = achiccn; // PER ORA NON INVIO A NESSUN ALTRO gm.dachi = "*****@*****.**"; gm.mandamail("", 0, "", "", out msg); if (msg.Trim() != "") { sStato.Text = "ATTENZIONE: credenziali utente non inviate correttamente. Contatare il servizio assistenza al n. " + Session["assistenza"].ToString(); } else { sStato.Text = "Utente abilitato e inviata mail con nuove credenziali!"; } } else { sStato.Text = "Modifica effettuata."; } } else // devo aggiungere la nuova gara { Stato("Inserimento nuova richiesta non andata a buon fine. Prego contattare servizio assistenza al n. " + Session["assistenza"].ToString(), Color.Red); return; } }
protected void cbRegistrati_Click(object sender, EventArgs e) { id = Session["iduser"] != null?Int32.Parse(Session["iduser"].ToString()) : -1; if (id >= 0) { utente.cercaid(id); // mi assicuro di leggere abilitato e pwd (quei dati che non chiedo a video) } // avvia i controlli string er = ""; if (tNikname.Text.Length < 7 || tNikname.Text.Trim().Length > 24) { er += "Username con almeno 8 caratteri (max 24); "; } if (tNome.Text.Length < 2) { er += "Nome con almeno 3 caratteri; "; } if (tCognome.Text.Length < 2) { er += "Cognome con almeno 3 caratteri; "; } if (tMail1.Text.Length < 6 || (tMail1.Text.IndexOf("@") < 1) || (tMail1.Text.IndexOf(".") < 1)) { er += "E-Mail con almeno 7 caratteri e con il simbolo @ e il simbolo . ; "; } if (tMail1.Text != tMail2.Text) { er += "E-Mail e Conferma E-Mail; "; } //if (tMatricola.Text.Length < 4) er += "Matricola; "; if (cbNonPresente.Checked) // ente non presente -> può essere che ddlselezionato ma nonpresente = vero!!!!! { if (tEnte.Text.Trim().Length < 3) { er += "Ente con almeno 3; "; } } else if (ddlEnte.SelectedItem.Text.Trim().Length < 2) { er += "Ente non selezionato; "; } if (tIndirizzo.Text.Length < 5) { er += "Indirizzo con almeno 6 caratteri; "; } if (tCivico.Text.Trim().Length < 1) { er += "Civico; "; } if (tCap.Text.Trim().Length < 5) { er += "Cap con almeno 6 caratteri; "; } if (tCitta.Text.Trim().Length < 2) { er += "Città con almeno 3 caratteri; "; } if (tTelefono.Text.Trim().Length < 8) { er += "Telefono con almeno 9 caratteri; "; } if (tTelefono.Text.IndexOf(" ") > 0) { er += "Telefono: solo numeri senza spazi; "; } if (!cbConsenso.Checked) { er += "Consenso al trattamento: è necessario; "; } if (cbNonPresente.Checked && tEnte.Text.Trim().Length < 3) { er += "Ente: con almeno 3 caratteri; "; } if (!cbNonPresente.Checked && ddlEnte.SelectedItem.Text.Trim().Length < 2) { er += "Ente: con almeno 2 caratteri; "; } if (er != "") { er = "I valori dei campi indicati sono errati o mancanti: " + er; tStato.Text = er; return; } utente.nikname = tNikname.Text.Trim(); utente.nome = tNome.Text.Trim(); utente.cognome = tCognome.Text.Trim(); utente.mail = tMail1.Text.Trim(); //utente.matricola = tMatricola.Text.Trim(); utente.ente = cbNonPresente.Checked ? tEnte.Text.Trim() : ddlEnte.SelectedItem.Text.Trim(); utente.ente_ek = ""; utente.tipoente_ek = ""; Gare gara = new Gare(); tbl = gara.CercaEnte(null, utente.ente, out msg); if (tbl != null && tbl.Rows[0]["tipoente_ek"] != DBNull.Value) { utente.tipoente_ek = tbl.Rows[0]["tipoente_ek"].ToString().Trim(); } utente.indirizzo = tIndirizzo.Text.Trim(); utente.civico = tCivico.Text.Trim(); utente.cap = tCap.Text.Trim(); utente.città = tCitta.Text.Trim(); utente.telefono = tTelefono.Text.Trim(); utente.scadenza = DateTime.Now.AddMonths(12); // non ci sono errori di inserimento e posso registrare la richiesta o la modifica if (id > 0) // è una modifica { bool ok = utente.registradatiutente("Modifica anagrafica utente", (Int32)id); if (!ok) { tStato.Text = "Modifiche non apportate. Contattare il servizio assistenza al n. " + Session["assistenza"].ToString(); return; } Response.Redirect("menu.aspx?p=" + utente.iduser.ToString().Trim() + "&l=si"); } else { // devo controllare se l'utente c'è già, se no lo registro ed invio mail di richiesta registrazione ed abilitazione // poi ritorno alla pagina di default con loggato = no DataSet ds = new DataSet(); SQLClass.SQLc.Parameters.Clear(); SQLClass.SQLc.Parameters.Add("@nikname", SqlDbType.NVarChar); SQLClass.SQLc.Parameters["@nikname"].Value = System.Convert.ToString(utente.nikname); if (SQLClass.getSQLdata("select * from utenti where nikname=@nikname", "utenti", out msg) > 0) { tStato.Text = "Utente con username " + utente.nikname + " già presente. Accertarsi di non essere già stati registrati o cambiare Username!"; //ShowPopUpMsg("Utente con username " + utente.nikname + " già presente. Accertarsi di non essere già stati registrati o cambiare Username!"); return; } else { utente.password = utente.CalcolaPasswordCasuale(8, 3, 3, 3); utente.abilitato = false; utente.forzocambiopassword = true; utente.giornalizza = false; //utente.ente = (utente.ente); if (utente.aggiungiutente()) { // ok registrazione effettuata. ora manda mail agli amministratori // devo rileggere il record aggiunto per avere l'id if (!utente.cercanikname(utente.nikname, utente.password)) { tStato.Text = "Richiesta di registrazione non andata a buon fine. Prego contattare l'assistenza al n. " + (string)Session["assistenza"]; return; //ShowPopUpMsg("Richiesta di registrazione non andata a buon fine. Prego contattare l'assistenza al n. " + (string)Session["assistenza"]); } Session.Add("Utente", utente.nikname); Session.Add("iduser", utente.iduser); // inoltro mail a tutti gli amministratori msg = ""; ds.Clear(); tbl = SQLClass.getfromDSet("select id, nikname, nome, cognome, mail, power from utenti where (power >= 50)", "Admin", out msg); if (msg.Trim() != "") { tStato.Text = "Attenzione: problema di connessione. Prego contattare il n. " + (string)Session["assistenza"]; return; } int k = 0, n = tbl.HasErrors ? 0 : tbl.Rows.Count; string[] achisccn = new string[n]; string[] achi = new string[1]; achi[0] = utente.mail; for (int i = 0; i < n; i++) { if (tbl.Rows[i]["Mail"] != DBNull.Value) { achisccn[k++] = tbl.Rows[i]["Mail"].ToString(); } } if (k == 0) { tStato.Text = "Attenzione: non ci sono amministratori che posso confermare la tua richiesta. Prego contattare il n. " + (string)Session["assistenza"]; //ShowPopUpMsg("Attenzione: non ci sono amministratori che posso confermare la tua richiesta. Prego contattare il n. " + (string)Session["assistenza"]); } else { gmail gm = null; gm = new gmail(); gm.dachivisualizzato = "Agenzia prov. pre gli Appalti e Contratti"; gm.achi = achi; gm.achiccn = achisccn; gm.numeritel = "0461-496456"; gm.subject = "Raccolta fabbisogno: richiesta registrazione nuovo utente"; gm.body = "Buongiorno,\n"; gm.body += "\tla informaiamo che la sua domanda di registrazione all'applicazione web\n"; gm.body += "per la presentazione delle richieste di gara per le quali s'intende avvalersi\n"; gm.body += "dei servizi offerti da APAC è stata inoltrata correttamente.\n"; gm.body += "\n\nI dati inseriti sono:\n"; gm.body += "Username: \t" + utente.nikname + "\n"; gm.body += "Nome: \t" + utente.nome + "\n"; gm.body += "Cognome: \t" + utente.cognome + "\n"; gm.body += "Mail: \t" + utente.mail + "\n"; gm.body += "Tel.: \t" + utente.telefono + "\n\n\n"; gm.body += "Dopo l'approvazione, riceverà automaticamente la mail con le credenziali per il primo accesso.\n\n"; gm.body += "Cordiali saluti.\n"; if (!gm.mandamail("", 0, "", "", out msg)) { tStato.Text = "Richiesta di registrazione non eseguita! MAIL DI CONFERMA NON INOLTRATA!. CONTATTARE IL NUMERO " + (string)Session["assistenza"] + " Err: " + msg; //ShowPopUpMsg("Richiesta di registrazione effettuata con successo, MAIL DI CONFERMA NON INOLTRATA!. CONTATTARE IL NUMERO " + (string)Session["assistenza"] + " Err: " + msg); } else { tStato.Text = "Richiesta di registrazione effettuata con successo. Riceverà via email le credenziali per l'accesso."; cbRegistrati.Enabled = false; //ShowPopUpMsg("Richiesta di registrazione effettuata con successo. Riceverà, entro 24 ore via email, le credenziali per l'accesso."); } } } else { tStato.Text = "Richiesta di registrazione non andata a buon fine. Prego contattare l'assistenza al n. " + (string)Session["assistenza"]; } } } }
private const string P_TYPE_FORM_value = "form";//추후 구현할 value값 public SendEmail() { mensagem = new gmail(); this._httpContext = HttpContext.Current; this.xmlCommonUtil = new XMLCommonUtil(); }