0% found this document useful (0 votes)
32 views2 pages

Enviar Mensajes Cshap

public partial class Form1 : Form private string To; private string Subject; private string Body; private MailMessage mail; private Attachment Data. public void examinarBtn_Click(object sender, EventArgs e) private void archivoAdjTxt.Text.Trim() == ""

Uploaded by

Roy Vidal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Enviar Mensajes Cshap

public partial class Form1 : Form private string To; private string Subject; private string Body; private MailMessage mail; private Attachment Data. public void examinarBtn_Click(object sender, EventArgs e) private void archivoAdjTxt.Text.Trim() == ""

Uploaded by

Roy Vidal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Net.Mime;
namespace EnviarCorreo
{
public partial class Form1 : Form
{
private string To;
private string Subject;
private string Body;
private MailMessage mail;
private Attachment Data;
public Form1()
{
InitializeComponent();
}
private void examinarBtn_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
archivoAdjTxt.Text = openFileDialog1.FileName;
}
private void enviarBtn_Click(object sender, EventArgs e)
{
if (!(toTxt.Text.Trim() == ""))
{
To = toTxt.Text;
Subject = asuntoTxt.Text;
Body = mensajeTxt.Text;
mail = new MailMessage();
mail.To.Add(new MailAddress(this.To));
mail.From = new MailAddress("tu correo@hotmail.com");
mail.Subject = Subject;
mail.Body = Body;
mail.IsBodyHtml = false;
if (!(archivoAdjTxt.Text.Trim() == ""))
{
Data = new Attachment(archivoAdjTxt.Text, MediaTypeNames.App
lication.Octet);
mail.Attachments.Add(Data);
}
SmtpClient client = new SmtpClient("smtp.live.com", 587);
using (client)
{
client.Credentials = new System.Net.NetworkCredential("tu co
rreo@hotmail.com", "contrasea del correo");
client.EnableSsl = true;
client.Send(mail);
}
MessageBox.Show("Mensaje enviado Exitosamente");
}
}


}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy