Hi, I have a form that allows a user to send an email to everyone on a mailing list (linq table). I'm having trouble with the correct code and syntax for linking to the smtp server.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Web.Security;
using System.Web.Mail;
using System.Configuration;
using System.Web.Configuration;
using System.Net.Configuration;
using System.Net.Mail;
public partial class MassEmail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
mailingListClassDataContext Class = new mailingListClassDataContext();
var emaillist = from emails in Class.mailinglistMembers select emails.email;
foreach (var subcriber in emaillist)
{
MailMessage objMail = new MailMessage();
objMail.From = "[email protected]";
objMail.To = subcriber;
objMail.BodyFormat = MailFormat.Html ;
//The subject of the message
objMail.Subject = "test email that i hope works" ;
//he message text
objMail.Body = Editor1.Content;
//need help in this area
SmtpClient client = new SmtpClient();
SmtpClient.Send(objMail);
}
}
}