|
Answer» I'm a BEGINNER of C# CODING and I need some help. What I want to is allow someone to send an email, by typing in their own email into a text box.
What I have so far is
Code: [Select] MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.mail.yahoo.com"); mail.From = new MailAddress("[email protected]"); //Do you need this?
mail.To.Add(textBox2.text);
mail.Subject = "New Email"; mail.Body = "INFO goes here"; SmtpServer.Port = 465; SmtpServer.Credentials = new System.Net.NetworkCredential("GmailInfo", "PASS***"); SmtpServer.EnableSsl = true; System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment(textBox1.Text); mail.Attachments.Add(attachment); SmtpServer.Send(mail);
The part I need help on is isolated
Code: [Select]mail.To.Add(textBox2.text);
How could you type into a text box and put that as the mail recipient?
|