Not sending message or opening dialog with this code. Help?

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Net.Mail; using System.Net;

namespace Attendance_Logger_Pro { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

 private void button1_Click(object sender, EventArgs e) { textBox3.Text = (textBox1.Text + " did not attend band on " + textBox4.Text + "This is an automated response from <company> Music. Please do not reply to this email. Replies to this auto-response will not be received."); try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com", 587); mail.From = new MailAddress("<email>@gmail.com"); mail.To.Add(textBox2.Text); mail.Subject = textBox1.Text + "'s Attendance Today "; mail.Body = textBox3.Text ; SmtpServer.Credentials = new System.Net.NetworkCredential("alpbotriverton@gmail.com", "4ttendanceloggerpro"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); MessageBox.Show("The attendance was delivered successfully."); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } 

}

by UltimateDracoMeteor via /r/csharp

Leave a Reply