Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Net.Mail
- Public Class Form1
- Private Sub email1()
- Dim comida = ComboBox1.SelectedItem
- Dim bebida = ComboBox2.SelectedItem
- Dim nombre = TextBox1.Text
- Dim apellido = TextBox2.Text
- Try
- Dim Smtp_Server As New SmtpClient
- Dim e_mail As New MailMessage()
- Smtp_Server.UseDefaultCredentials = False
- Smtp_Server.Credentials = New Net.NetworkCredential("juan-breydy@hotmail.com", "tingomaria2015")
- Smtp_Server.Port = 587
- Smtp_Server.EnableSsl = True
- Smtp_Server.Host = "smtp.office365.com"
- e_mail = New MailMessage()
- e_mail.From = New MailAddress("juan-breydy@hotmail.com")
- e_mail.To.Add("juan-breydy@hotmail.com")
- e_mail.Subject = ("Encuesta:" + nombre + apellido)
- e_mail.IsBodyHtml = False
- e_mail.Body = ("TIQUETE" + vbNewLine + "Comida: " + comida + vbNewLine + "Bebida: " + bebida + vbNewLine + "Usuario: " + nombre + apellido)
- Smtp_Server.Send(e_mail)
- Catch error_t As Exception
- MsgBox("ha ocurrido un error")
- Exit Sub
- End Try
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim comida = ComboBox1.SelectedItem
- Dim bebida = ComboBox2.SelectedItem
- Dim nombre = TextBox1.Text
- Dim apellido = TextBox2.Text
- email1()
- End Sub
- Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
- End Sub
- End Class
Add Comment
Please, Sign In to add comment