using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;
namespace SistemaIAN
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void BulletedList1_Click(object sender, BulletedListEventArgs e)
{
}
protected void Conocenos_Click(object sender, EventArgs e)
{
}
protected void Enviar_Click(object sender, EventArgs e)
{
MailMessage msg = new MailMessage();
msg.To.Add("pucciarelligm@sistemaian.com.ar");
msg.From = new MailAddress("sistemas@sistemaian.com.ar", "Mensaje enviado desde " + TextEmail.Text, System.Text.Encoding.UTF8);
msg.Subject = comboMotivo.Text + " de " + TextNombre.Text;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = "Mensaje de " + TextNombre.Text.Trim() + Environment.NewLine + TextComentario.Text.Trim() + Environment.NewLine + "E-Mail: " + TextEmail.Text.Trim();
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = false; //Si vas a enviar un correo con contenido html entonces cambia el valor a true
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("sistemas@sistemaian.com.ar", "itaca660");
client.UseDefaultCredentials = true;
client.Port = 465;
client.Host = "ca4.toservers.com";//Este es el smtp valido para Gmail
client.EnableSsl = true; //Esto es para que vaya a través de SSL que es obligatorio con GMail
try
{
client.Send(msg);
Response.Write("");
}
catch (Exception ex)
{
Response.Write("");
}
TextComentario.Text = "";
TextNombre.Text = "";
TextEmail.Text = "";
}
}
}