468,268 Members | 1,754 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,268 developers. It's quick & easy.

Email

what would be the best technology to send emails in a ASP.NET Application?
I used to use CDONTS with ASP.

thanks,
Nov 17 '05 #1
1 1119
Well, here is the lazy answer (this is what I ended up doing). Include
CDONTS (the COM object) in your references.. and use it like this:

CDONTS.NewMailClass objMail = new CDONTS.NewMailClass();
string SendFrom = Request.Form["From"] + " <" + Request.Form["FromEmail"] +
">";
string SendTo ="Frank Drebin <so*******@someemail.com>";
string From = Request.Form["From"];
string FromEmail = Request.Form["FromEmail"];
string Subject = Request.Form["Subject"];
string Msg = Request.Form["Msg"].Replace("\n","<br>"); // Replace carriage
returns with line breaks
string BodyText = "";
BodyText += "<STYLE> .MsgTxt { font-family:Verdana, Arial; font-size: 10pt;
font-style: normal; line-height: normal;font-weight: normal} </STYLE>";
BodyText += "<ul>";
BodyText += "<table width=\"100%\">\n";
BodyText += "<tr><td class=MsgTxt>From:</td><td class=MsgTxt><b>" + From + "
(<a href=mailto:" + FromEmail + ">" + FromEmail + "</a>)</b></td>\n";
BodyText += "<tr><td class=MsgTxt>Sent:</td><td class=MsgTxt><b>" +
DateTime.Now.ToString() + "</b></td>\n";
BodyText += "<tr><td class=MsgTxt>Subject:</td><td class=MsgTxt><b>" +
Subject + "</b></td>\n";
BodyText += "</table><hr>\n";
BodyText += Msg + '\n';
BodyText += "-----\n";
BodyText += "</ul>";
objMail.BodyFormat = 0;
objMail.MailFormat = 0;
objMail.Send(SendFrom,SendTo, Subject, BodyText, 1);
"JMMB" <mb*******@bf.com.br> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
what would be the best technology to send emails in a ASP.NET Application?
I used to use CDONTS with ASP.

thanks,

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Chuck Anderson | last post: by
88 posts views Thread by Mike | last post: by
2 posts views Thread by BSG-SMTP-Gateway | last post: by
26 posts views Thread by libsfan01 | last post: by
3 posts views Thread by g0c | last post: by
3 posts views Thread by Erik Johnson | last post: by
15 posts views Thread by Craig Hurley | last post: by
3 posts views Thread by IGD | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.