public void DeleteEmail() { email aux_email = new email(); if (SelectedEmail != null) { aux_email.author_dni = Author.dni; aux_email.id_email = SelectedEmail.id_email; aux_email.address = SelectedEmail.address; this.Dialogs.Add(new AutorDialogViewModel { Title = "Esborrar Email", Mail = aux_email, Id_item = aux_email.id_email, Type_item = "Email", DataText = "Adreça", Data_item = aux_email.address, TextEnabled = false, TextEnabled_type = false, OkText = "Esborrar", OnOk = (sender) => { Author.emails.Remove(SelectedEmail); FillEmails(); sender.Close(); }, OnCancel = (sender) => { sender.Close(); }, OnCloseRequest = (sender) => { sender.Close(); } }); } }
public void AddEmail(ref OperationResult pobjOperationResult, emailDto pobjDtoEntity) { //mon.IsActive = true; int SecuentialId = 0; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); email objEntity = emailAssembler.ToEntity(pobjDtoEntity); SecuentialId = Utils.GetNextSecuentialId(1, 400); objEntity.i_EmailId = SecuentialId; dbContext.AddToemail(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return; } }
private void verificarEmail() { string response = InterfaceHttp.VerficarCorreo(nuevoUsuario); //codigo de agregar if (response.Equals("Error")) { Mensaje("Ha habido un error al verificar el correo"); } else if (response.Equals("ocupado")) { Mensaje("Este correo ya se encuentra ligado a una cuenta existente"); } else { //enviar codigo de verificacion string to = nuevoUsuario.Correo; string subject = "Validacion de email"; string message = "El codigo de verificacion es el siguiente:" + response; email correoCheck = new email(to, subject, message); if (correoCheck.sendEmail()) { Mensaje("Correo de verificación enviado.\n"); } else { Mensaje("Error al enviar el correo de verificación"); } } }
public static email UpdateMail(int id, email e) { try { email e0 = dataContext.emails.Where(x => x.emailId == id).SingleOrDefault(); if (e.tipus != null) { e0.tipus = e.tipus; } if (e.email1 != null) { e0.email1 = e.email1; } if (e.contacteId != null) { e0.contacteId = e.contacteId; } dataContext.SaveChanges(); return(GetEmail(id)); } catch (Exception ex) { return(null); } }
public ActionResult sendemail(email model) { RequestModelContext db = new RequestModelContext(); //var customerName = Request["customerName"]; //var customerEmail = Request["customerEmail"]; //var customerRequest = Request["customerRequest"]; var errorMessage = ""; var debuggingFlag = false; try { // Initialize WebMail helper WebMail.SmtpServer = "smtp.gmail.com"; WebMail.SmtpPort = 25; WebMail.EnableSsl = true; WebMail.UserName = "******"; WebMail.Password = "******"; WebMail.From = model.to; // Send email WebMail.Send(to: model.to, subject: "Администратор " + model.to + " готов Вам помочь", body: model.to ); } catch (Exception ex) { errorMessage = ex.Message; } return(View()); }
public ActionResult correoindex(email em) { string to = em.To; string subject = em.Subject; string bodey = em.Body; MailMessage mm = new MailMessage(); mm.To.Add(to); mm.Subject = subject; mm.Body = bodey; mm.From = new MailAddress("*****@*****.**"); // mm.From = new MailAddress("*****@*****.**"); //empresarial mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); smtp.Port = 587; smtp.UseDefaultCredentials = true; smtp.EnableSsl = true; // smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "admindie"); // permisos auth terceros smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "admindie"); smtp.Send(mm); ViewBag.message = "Email fue enviado a " + em.To + " , con éxito"; return(View()); }
public ActionResult newmail(string Email) { email email = new email(); email.mail = Email; return(PartialView("_email", email)); }
public static void DeleteEmail(int id) { email e = dataContext.emails.Where(x => x.emailId == id).SingleOrDefault(); dataContext.emails.Remove(e); dataContext.SaveChanges(); }
public async Task <ActionResult> SendEmail([FromBody] email mail) { if (ModelState.IsValid) { var body = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p>"; var message = new MailMessage(); message.To.Add(new MailAddress(mail.FromEmail)); message.From = new MailAddress("*****@*****.**"); message.Subject = mail.EmailSubject; message.Body = string.Format(body, mail.FromName, mail.FromEmail, mail.Message); message.IsBodyHtml = true; using (var smtp = new SmtpClient()) { var credential = new NetworkCredential { UserName = "******", Password = "******" }; smtp.Credentials = credential; smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; await smtp.SendMailAsync(message); } } return(Ok(mail)); }
public HttpResponseMessage PostE([FromBody] email val) { var e = ContactesRepository.CreateMail(val); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, e); return(response); }
public HttpResponseMessage PutE(int id, [FromBody] email val) { var email = ContactesRepository.UpdateMail(id, val); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, email); return(response); }
public void AddEmail() { email aux_mail = new email(); aux_mail.author_dni = Author.dni; this.Dialogs.Add(new AutorDialogViewModel { Title = "Afegir Email", Mail = aux_mail, DataText = "Adreça", OkText = "Afegeix", Type_item = "Email", TextEnabled = true, TextEnabled_type = false, OnOk = (sender) => { if (this.validate_mail(aux_mail.address)) { Author.emails.Add(aux_mail); FillEmails(); sender.Close(); } else { MessageBox.Show("Email incorrecte. Insereixi un correu vàlid."); } }, OnCancel = (sender) => { sender.Close(); }, OnCloseRequest = (sender) => { sender.Close(); } }); }
public ActionResult DeleteConfirmed(int id) { email email = db.email.Find(id); db.email.Remove(email); db.SaveChanges(); return(RedirectToAction("Index")); }
public int SendPassword([FromBody] email myemail) { //check exist or not int count = 0; count = checkuserexistbyemail(myemail.email_to); if (count >= 1) { string emailcontent = getpasswordbyemail(myemail.email_to); int sendemail_status = 0; sendemail_status = Sendemail(myemail.email_to, "Your Password for DailyLife App", emailcontent); if (sendemail_status == 20) { MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = ConfigurationManager.ConnectionStrings["apidb"].ConnectionString; MySqlCommand sqlCmd = new MySqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.CommandText = "INSERT INTO email_send_history (userid,email_to,content,send_date,send_from) Values (@userid,@email_to,'" + emailcontent + "',NOW(),'ADMIN')"; sqlCmd.Connection = myConnection; sqlCmd.Parameters.AddWithValue("@userid", myemail.userid); sqlCmd.Parameters.AddWithValue("@email_to", myemail.email_to); try { myConnection.Open(); int rowInserted = sqlCmd.ExecuteNonQuery(); //get password and send email success. return(2); } catch { //get password and send email success but insert history failed. return(3); } finally { myConnection.Close(); } } else { //4: Get password success but send email failed! return(4); } } else { //5: No email exists! return(5); } }
public ActionResult Edit([Bind(Include = "id,id_pessoa,tipo,email1")] email email) { if (ModelState.IsValid) { db.Entry(email).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_pessoa = new SelectList(db.pessoa, "id", "nome", email.id_pessoa); return(View(email)); }
private static email ConvertToEmail(this Mail mail) { email email = new email(); email.from = mail.MailSender; var to = from refs in mail.Refs where refs.AddresseeClass == AddresseeType.TO select refs.AddresseeMail; if (to.Count() == 0) { return(null); } email.to = String.Join(",", to.ToArray()); var cc = from refs in mail.Refs where refs.AddresseeClass == AddresseeType.CC select refs.AddresseeMail; if (cc.Count() > 0) { email.cc = String.Join(",", cc.ToArray()); } var ccn = from refs in mail.Refs where refs.AddresseeClass == AddresseeType.CCN select refs.AddresseeMail; if (ccn.Count() > 0) { email.bcc = String.Join(",", ccn.ToArray()); } if (!String.IsNullOrEmpty(mail.Subject)) { email.subject = mail.Subject; } email.body = mail.MailText; email.body_encoding = emailBody_encoding.UTF8; email.body_format = emailBody_format.HTML; //if (mail.HasAttachment) //{ // email.attachments = (from att in mail.Attachments // select new Attachement // { // tipo = att.AttachmentExtension, // nome = Guid.NewGuid().ToString(), // file = att.AttachmentFile // }).ToArray(); //} return(email); }
public ActionResult Edit([Bind(Include = "idemail,email1,idsucursal")] email email) { if (ModelState.IsValid) { db.Entry(email).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idsucursal = new SelectList(db.sucursal, "idsucursal", "nombre", email.idsucursal); return(View(email)); }
public ActionResult Edit([Bind(Include = "Id,endereco,assunto,corpo,remetente,ApplicationUserID")] email email) { if (ModelState.IsValid) { db.Entry(email).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ApplicationUserID = new SelectList(db.Users, "Id", "Email", email.ApplicationUserID); return(View(email)); }
private static void AddEmailToConstituent(Donor d, ref constituent constt, bool setPrimary = false, bool SendToApi = false) { try { var email = new email { emailAddress = d.Email, emailDisplay = d.FullName, primary = setPrimary, createDate = DateTime.Now, updateDate = DateTime.Now, customFieldMap = new abstractCustomizableEntityEntry[0], }; if (constt.emails == null) { constt.emails = new email[1]; constt.emails[0] = email; } else { var newmax = constt.emails.Count() + 1; var newArray = new email[newmax]; constt.emails.CopyTo(newArray, 0); newArray[newmax - 1] = email; constt.emails = newArray; } if (SendToApi) { var saveOrUpdateConstituentRequest = new SaveOrUpdateConstituentRequest { constituent = constt }; _client.SaveOrUpdateConstituent(saveOrUpdateConstituentRequest); } } catch (FaultException exception) { Type exType = exception.GetType(); MessageFault mf = exception.CreateMessageFault(); Console.WriteLine("Error when adding email to constituent // " + exception.Message); if (mf.HasDetail) { var detailedMessage = mf.GetDetail <System.Xml.Linq.XElement>(); String message = detailedMessage.FirstNode.ToString(); Console.WriteLine("More details // " + message); } } catch (Exception exc) { var txt = exc; } }
public static bool Send(ISendGridClient sendGridClient, email dadosMSG) { var message = new SendGridMessage { Subject = dadosMSG.assunto, PlainTextContent = dadosMSG.conteudo, From = new EmailAddress(dadosMSG.remetente), }; message.AddTo(dadosMSG.destinatario); return(sendGridClient.SendEmailAsync(message).Result.IsSuccessStatusCode); }
public IActionResult Create(email email, string returnUrl = null) { if (ModelState.IsValid) { this.repository.AddEntity(email); return(RedirectToLocal(returnUrl)); } ViewData["ParentId"] = email.hookId; ViewData["ReturnUrl"] = returnUrl; return(View(email)); }
public ActionResult Create([Bind(Include = "idemail,email1,idsucursal")] email email) { if (ModelState.IsValid) { db.email.Add(email); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idsucursal = new SelectList(db.sucursal, "idsucursal", "nombre", email.idsucursal); return(View(email)); }
public ActionResult Create([Bind(Include = "id,id_pessoa,tipo,email1")] email email) { if (ModelState.IsValid) { db.email.Add(email); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_pessoa = new SelectList(db.pessoa, "id", "nome", email.id_pessoa); return(View(email)); }
public ActionResult Create([Bind(Include = "Id,endereco,assunto,corpo,ApplicationUserID")] email email) { ViewBag.ApplicationUserID = new SelectList(db.Users, "Id", "Email", email); if (ModelState.IsValid) { db.email.Add(email); db.SaveChanges(); // return RedirectToAction("Index"); } return(Json(email, JsonRequestBehavior.AllowGet)); }
static void Main(string[] args) { var _awsAccessKeyId = "aqui_vai_a_AccessKeyId"; var _awsSecretAccessKey = "aqui_vai_a_SecretAccessKey"; var _nameQueue = "nome_da_fila_na_AWS"; var _from = "*****@*****.**"; var _recipient = "*****@*****.**"; var _subject = "assunto do email"; var _content = "conteudo do email"; var dadosEmail = new email(_subject, _recipient, _from, _content); string msg = JsonConvert.SerializeObject(dadosEmail); // acesso ao cliente SQS da AWS IAmazonSQS sqs = new AmazonSQSClient(_awsAccessKeyId, _awsSecretAccessKey, RegionEndpoint.SAEast1); // conexao com a fila pelo nome var sqsRequest = new CreateQueueRequest { QueueName = _nameQueue }; var createQueueResponse = sqs.CreateQueueAsync(sqsRequest).Result; // get na url da fila pelo nome var myQueueUrl = createQueueResponse.QueueUrl; var listQueueRequest = new ListQueuesRequest(); var listQueuesResponse = sqs.ListQueuesAsync(listQueueRequest); var sqsMessageRequest = new SendMessageRequest { QueueUrl = myQueueUrl, MessageBody = msg }; if (sqs.SendMessageAsync(sqsMessageRequest).Result.HttpStatusCode.ToString() == "OK") { Console.WriteLine("menssagem enviada"); } else { Console.WriteLine("nao menssagem enviada"); } }
public static email CreateMail(email e) { try { dataContext.emails.Add(e); dataContext.SaveChanges(); return(GetEmail(e.emailId)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
// GET: Emails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } email email = db.email.Find(id); if (email == null) { return(HttpNotFound()); } return(View(email)); }
public HttpResponseMessage Send([FromBody] email _email) { string host = Properties.Settings.Default.host; int port = Properties.Settings.Default.port; bool ssl = Properties.Settings.Default.ssl; string loginName = Properties.Settings.Default.loginname; string pwd = Properties.Settings.Default.pwd; string sendfrom = Properties.Settings.Default.sendfrom; string displayName = Properties.Settings.Default.displayname; string subject = _email.lang == "fr" ? Properties.Settings.Default.subject_fr : Properties.Settings.Default.subject; //string subject = Properties.Settings.Default.subject; bool result = false; //sendfromInternal(host, port, ssl, loginname, pwd, sendfrom, displayname, receiver, subject, body) try { result = es.sendfromInternal(host, port, ssl, loginName, pwd, sendfrom, displayName, _email.receiver, subject, _email.body); } catch (Exception e) { e.Message.ToString(); } if (result) { var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent("\"status\":\"OK\"", Encoding.UTF8); response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); logservices.logservices(request, response, string.Empty, string.Empty, "send", _email.lang, string.Empty, subject, "email", _email.receiver); return(response); } else { var response = this.Request.CreateResponse(HttpStatusCode.NotFound); response.Content = new StringContent("\"status\":\"Failed\"", Encoding.UTF8); response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); logservices.logservices(request, response, string.Empty, string.Empty, "send", _email.lang, string.Empty, subject, "email", _email.receiver); return(response); } }
// GET: Emails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } email email = db.email.Find(id); if (email == null) { return(HttpNotFound()); } ViewBag.id_pessoa = new SelectList(db.pessoa, "id", "nome", email.id_pessoa); return(View(email)); }
// GET: Email/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } email email = db.email.Find(id); if (email == null) { return(HttpNotFound()); } ViewBag.ApplicationUserID = new SelectList(db.Users, "Id", "Email", email.ApplicationUserID); return(View(email)); }
public dict create(IContext ctx, idstring userid, password password, varchar realname, email email) { dict Return = new dict(); // your code goes here; add return values to 'Return' bool status = false; string message = "unknown error"; long pver; if (userid.str.Length < 5 || !Helpers.IsValidId(userid.str)) { message = "bad user id format: non-special characters, at least length 5 required"; } else if (KeyValueStore.Find("user:"******"the user id " + userid + " already exists"; } else if (KeyValueStore.Find("email:" + email, out pver) != null) { message = "the email address " + email + " is already tied to another user id"; } else { dict user = new dict(); user.Add("userid", userid.str); user.Add("password", password.str); user.Add("realname", realname.str); user.Add("email", email.str); user.Add("activationkey", Helpers.RandomString(24)); if (KeyValueStore.Store("user:"******"user " + userid + " created"; status = true; } else { message = "database error when trying to create user " + userid; } } Return.Add("status", status); Return.Add("message", message); return Return; }
public void LogError(long order_id,string err_subject, string err_msg,oCreateOrderRequest o, string ip) { try { email em = new email(); em.SendEmail("*****@*****.**", "*****@*****.**", "", "*****@*****.**", "RedBubble endpoint", err_subject, err_msg, "smtp.yourself.com", "", "", "", false); using (var dc = new redbubbleDataContext()) { dc.sp_insert_orders_error_log(order_id, err_subject, err_msg, ip); } } catch { } try { var json = new JavaScriptSerializer().Serialize(o); using (var dc2 = new redbubbleDataContext()) { dc2.sp_update_ordrers_err_log_json(order_id, json.ToString()); } } catch { } }
// The general function to decrypt a mail, depending on settings // Uses asymmetric.cs and symmetric.cs functions public static email decryptMail(email mail, bool useSymmetric, string symmetricKey, bool useAsymmetric, MerMail.Asymmetric.Key privatekey) { // We are maybe going to modify contents in the mail, so we store it email rtn = mail; // We are maybe going to decrypt the symmetric key, so we store it too string symKey = symmetricKey; // We symmetricly decrypt the message body (if chosen) if (useSymmetric) { // we asymmetricly decrypt the symmetric key (if chosen) if (useAsymmetric) { symKey = MerMail.Asymmetric.DecryptString(symmetricKey, privatekey); } rtn.body = MerMail.Symmetric.DecryptString(symKey, rtn.body); } return rtn; }
// Get mails from the SQLite database // Used to put mails into the listBox public static void ImportMails(object sender, DoWorkEventArgs e) { // get from database List<email> allMessages = new List<email>(); SQLiteCommand cmd = new SQLiteCommand("SELECT sender,subject,body,date FROM messagetable ORDER BY date DESC", msgSqlCon); SQLiteDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { email tmp = new email(reader.GetString(0), reader.GetString(1), MerMail.Symmetric.DecryptString(currentUser.encryption_key, reader.GetString(2)), reader.GetString(3)); allMessages.Add(tmp); } e.Result = allMessages; }
// The general function to encrypt a mail, depending on settings // Uses asymmetric.cs and symmetric.cs functions public static email encryptMail(email mail, bool useSymmetric, string symmetricKey, bool useAsymmetric, MerMail.Asymmetric.Key public_key) { // We are maybe going to modify contents in the mail, so we store it email rtn = mail; // We are maybe going to encrypt the symmetric key, so we store it too string symKey = symmetricKey; // We'll make it easy for the user to know, if the symmetric key // is encrypted or not string symKeyName = "symmetric_raw.txt"; string diagTitle = "Save symmetric key to file"; // We symmetricly encrypt the message body (if chosen) if (useSymmetric) { // We'll encrypt the message, while we still know the symmetric key rtn.body = MerMail.Symmetric.EncryptString(symKey, rtn.body); // We asymmetricly encrypt the symmetric key (if chosen) if (useAsymmetric) { symKey = MerMail.Asymmetric.EncryptString(symmetricKey, public_key); // Now, we know that the symmetric key is encrypted, so we're // going to tell the user that we encrypted it symKeyName = "symmetric_encrypted.txt"; diagTitle = "Save encrypted symmetric key to file"; } } // Can be saved to any filetype (but we like .txt) MerMail.Program.saveFile(symKeyName, diagTitle, "Any (*.*)", "*.*", symKey); return rtn; }