In ASP.NET 2.0, Microsoft deprecated the System.Web.Mail namespace and replaced it with System.Net.Mail. The new library introduces some new features, but it also includes some bugs in how mail is sent. Before discussing some of these in detail, let's go through some code sample (which assumes you've added a using System.Net.Mail at the top of the file):
MailMessage msg = new MailMessage();
msg.From = new MailAddress("address@domain.com", "Person's Name");
msg.To.Add(new MailAddress("destination@domain.com",
"Addressee's Name");
msg.To.Add(new MailAddress("destination2@domain.com",
"Addressee 2's Name");
msg.Subject = "Message Subject";
msg.Body = "Mail body content";
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient c = new SmtpClient("mailserver.domain.com");
c.Send(msg);
The code is similar with some minor changes to how you address the message. Instead of constructing an address, you can let the system do that for you. If you specify an e-mail address and a name, it will automatically display in the message as this:
"Person's Name" <destination@domain.com>
This is the "proper" form for an e-mail address. You can add multiple addresses to the To, CC, and BCC collections in the same way as shown above. This is programmatically easier to do than sending lots of messages—just add multiple addresses to the BCC property in order to send a mass mailing.
As previously mentioned, this new namespace has a couple of bugs. The first is when you send a message the headers are all added in lowercase letters. While the RFC for SMTP mail doesn't specify how the headers should be capitalized, many spam filters restrict messages where the headers are not properly capitalized.
The other bug deals with the Priority setting, which should mark a message as important within the mail client. Because of the way the header is formatted, my mail program (Eudora) doesn't recognize it as the priority flag and doesn't mark the message as important. While this seems trivial, it's a change from the System.Web.Mail version for no apparent reason. I'm continuing to research this and if I can't find a good fix, I may switch back to System.Web.Mail and deal with the warning messages that Visual Studio displays about System.Web.Mail being deprecated.
Hey it was really simple in asp.net as compared to any other languages ...
Only some very good tools have a head for resolving this problem. To my wat of thinking one of them is the next. Reason of the software relieved me in similar trouble couple days ago and owns many useful capabilities - recover outlook 2003 pst.
ReplyDeleteInteresting and important information. It is really beneficial for us. Thanks
ReplyDeleteWow, Fantastic article, it’s so helpful to me, and your blog is very good,
ReplyDeleteWow, Fantastic article, it’s so helpful to me, and your blog is very good,
ReplyDeleteHi friend...This was amazing article.Interesting and much more informative content.Thanks for sharing..
ReplyDeleteInteresting layout on your blog. I really enjoyed reading it and also I will be back to read more in the future.
ReplyDeleteThanks for this post. It Very nice Blog. It was a very good Blog. I like it. Thanks for sharing knowledge. Ask you to share good Blog again.
ReplyDeleteThanks for ones marvelous posting! I seriously enjoyed reading it, you're a great author.I will be sure to bookmark your blog and definitely will come back in the foreseeable future. I want to encourage you continue your great job, have a nice day!
ReplyDeletethanks dear
ReplyDeleteInteresting layout on your blog. I really enjoyed reading it and also I will be back to read more in the future.
ReplyDeleteInteresting and important information. It is really beneficial for us. Thanks
ReplyDeleteThank you, thats very interesting information. I need to share with my friends.
ReplyDeleteAnother informative blog… Thank you for sharing it… Best of luck for further endeavor too.
ReplyDeleteI’ve learned a lot from your blog here, Keep on going, my friend, I will keep an eye on it.
ReplyDeletereally I need this information thanks for needful information
ReplyDeleteI got many information and some important tips with the help of this post. I would like to visit again.
ReplyDeletevery cool tag and backlink hear and buy
ReplyDeleteloose diamonds
Interesting blog. I really enjoy for read this blog.......
ReplyDeleteWeb Designer India
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company India
ReplyDelete