views:

108

answers:

1

Usage:

Users create pretty HTML news letters in another app. They post the newsletter to the web, but they also want to set the contents of the HTML news letter file as the body of an email and send it using Application In Question.

The users understand to use absolute link and image references when sending an E Newsletter.

Environment:

AIQ is a VB.Net app deployed via ClickOnce. It is an intranet app; one can be sure MS Office 2003 and the interop 11 dlls are on the target machines.

Restrictions:

MAPI is out. It mangles the HTML.

Since it is a ClickOnce deployment, we can't register dlls (I think, correct me if I am wrong). Therefore CDO and COM is out (again, I may be wrong.... I would be happy to be proven so).

A: 

I'm not sure exactly what you're asking. If you're asking about HOW to send an email, the .NET Framework includes the System.Net.Mail namespace for sending out email via SMTP.

You can create a new SmtpClient. If it's deployed on a LAN then you can set the Host property to an Exchange server or other SMTP server.

You can then create a MailMessage with the body set to the HTML content to send.

Here's a sample:

 //create the mail message
 MailMessage mail = new MailMessage();

 //set the addresses
 mail.From = new MailAddress("[email protected]");
 mail.To.Add("[email protected]");

 //set the content
 mail.Subject = "This is an email";
 mail.Body = "this is a sample body with html in it. <b>This is bold</b> <font color=#336699>This is blue</font>";
 mail.IsBodyHtml = true;

 //send the message
 SmtpClient smtp = new SmtpClient("127.0.0.1");
 smtp.Send(mail);
Chris Thompson