public void MailContactenos(ContactenosBE objMensajeBE, String logoUrl) { try { objMailMessage.Body = "Saludos,<br/><br/>Le informamos que usted ha recibido un mensaje enviado desde la página de Dendro<br/><br/><b>Nombre:</b> " + objMensajeBE.Nombre + "<br/><br/><b>E-Mail:</b> " + objMensajeBE.Email + "<br/><br/><b>Mensaje:</b><br/>" + objMensajeBE.Mensaje; objMailMessage.To.Clear(); objMailMessage.To.Add(ConfigurationManager.AppSettings["Contacto"].ToString()); MailAddress objMailAddress = new MailAddress("*****@*****.**", "Dendro Website"); objMailMessage.From = objMailAddress; objMailMessage.Priority = MailPriority.High; AlternateView av_Html = AlternateView.CreateAlternateViewFromString(funcion_PlantillaMail(objMailMessage.Body), null, "text/html"); LinkedResource logo = new LinkedResource(logoUrl, "image/png"); logo.ContentId = "logo"; av_Html.LinkedResources.Add(logo); objMailMessage.Subject = "Mensaje Dendro Web"; objMailMessage.Body = ""; objMailMessage.AlternateViews.Clear(); objMailMessage.AlternateViews.Add(av_Html); setServidor().Send(objMailMessage); } catch (SmtpFailedRecipientException) { throw; } catch (SmtpException) { throw; } catch (Exception ex) { throw ex; } }
protected void btnEnviar_Click(object sender, EventArgs e) { ContactenosBE objContactenosBE = new ContactenosBE(); MailBC objMailBC = new MailBC(); try { objContactenosBE.Email = txtEmail.Text; objContactenosBE.Nombre = txtNombre.Text; objContactenosBE.Mensaje = txtMensaje.Text; objMailBC.MailContactenos(objContactenosBE, Server.MapPath("Images/logo.png")); ScriptManager.RegisterStartupScript(this, GetType(), "msg", "Alert('El mensaje fue enviado satisfactoriamente');", true); } catch (Exception) { throw; } }
protected void btnEnviar_Click(object sender, EventArgs e) { ContactenosBE objContactenosBE = new ContactenosBE(); MailBC objMailBC = new MailBC(); try { objContactenosBE.Comentario = txtMensaje.Text; objContactenosBE.Email = txtMail.Text; objContactenosBE.Nombre = txtNombre.Text; objMailBC.MailVCard(objContactenosBE, Server.MapPath("Images/logo_completo.png"), "*****@*****.**"); Tools.Alert("El mensaje fue enviado satisfactoriamente", "Envio de mensaje", GetType(), this); } catch (Exception) { throw; } }
public void MailVCard(ContactenosBE objMensajeBE, String logoUrl, String correo) { try { objMailMessage.Body = "Saludos,<br/><br/>" + "Le informamos que usted ha recibido un mensaje enviado desde su vCard<br/><br/>" + "<b>Nombre / Compañía:</b> " + objMensajeBE.Nombre + "<br/><br/>" + "<b>E-Mail:</b> " + objMensajeBE.Email + "<br/><br/>" + "<b>Mensaje:</b><br/>" + objMensajeBE.Comentario; objMailMessage.To.Clear(); objMailMessage.To.Add(correo); MailAddress objMailAddress = new MailAddress("*****@*****.**", "Linnso Website"); objMailMessage.From = objMailAddress; objMailMessage.Priority = MailPriority.High; AlternateView av_Html = AlternateView.CreateAlternateViewFromString(funcion_PlantillaMail(objMailMessage.Body), null, "text/html"); LinkedResource logo = new LinkedResource(logoUrl, "image/png"); logo.ContentId = "logo"; av_Html.LinkedResources.Add(logo); objMailMessage.Subject = "Mensaje vCard "; objMailMessage.Body = ""; objMailMessage.AlternateViews.Clear(); objMailMessage.AlternateViews.Add(av_Html); setServidor().Send(objMailMessage); } catch (SmtpFailedRecipientException) { throw; } catch (SmtpException) { throw; } catch (Exception ex) { throw ex; } }