Hi,
You can use MailMessage class from System.Web. Even it;s in that namespace
it can be used to send mail no matter what kind of application you have.
Here is some code of how to generate an email with an attachment.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
protected void SendByMail(string file)
{
MailMessage MyMail = new MailMessage();
MyMail.From = "(e-mail address removed)";
MyMail.To = ((CtpUser)Session["SystemUser"]).Email;
MyMail.Subject = "Web-CTP Report";
MyMail.Body = " Attached is the report requested";
MyMail.BodyEncoding = Encoding.ASCII;
MailAttachment MyAttachment = new MailAttachment(file);
MyMail.Attachments.Add(MyAttachment);
SmtpMail.SmtpServer =
System.Configuration.ConfigurationSettings.AppSettings["SMTPServer"];
SmtpMail.Send(MyMail);
}
Nadav said:
Hi,
I wonder... How can I send mail programmatically using c# ? Any
pointers/samples will be appriciated.