TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Fenech
NA
82
69.2k
Sending emails from database in C#
Apr 22 2011 1:56 PM
Hi im working on a software project with C# im stuck with this problem sending emails to specific emails works great now what i want is when i tick a checkbox emails from a table in database get in the add to Message etc...... this is my code:
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.EnableSsl = true;
smtp.Timeout = 10000;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("
[email protected]
", "mypassword");
message.From = new MailAddress("
[email protected]
", "Mark Fenech");
if (chcbox_members.Checked)
{
message.To.Add(// here im adding the db Code to Select Email from tblMember
}
else
{
message.To.Add(txt_emailTo.Text);
}
message.Subject = txt_Subject.Text;
message.Body = label9.Text + " " + label5.Text + "\n"+ label10.Text + " " + label6.Text + "\n" + label11.Text + " " + label7.Text+ "\n" + label12.Text + " "+ label8.Text;
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
smtp.Send(message);
This is an image of te design so you can understand more : http://i55.tinypic.com/wbtncm.jpg
Reply
Answers (
7
)
Create Index in visual studio C#
FileSystemWatcher and copy file