Posts

Showing posts from January, 2009

It's all about presentation...

My last post, you may notice has code snippets that look somewhat professional. I found a cool online tool called Code2html It turns this: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Mail; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { MailMessage message = new MailMessage("FROM@domain.foo", "TO@domain.foo", "SYNCHRONOUS MESSAGE", "MESSAGE BODY"); SmtpClient smtp = new SmtpClient(); smtp.Send(message); } protected void Button2_Click(object sender, EventArgs e) { MailMessage message = new MailMessage("FROM@domain.foo", "TO@domain.foo", "ASYNCHRONOUS MESSAGE", "MESSAGE BODY"); SmtpClient smtp = new SmtpClient

You had me at ehlo!

Image
It seems that a lot of websites send users email for lots of reasons. This introduces a bit of a problem when you are developing applications because as developers we don't necessarily want to put an smtp server on our development machine and network administrators are fairly selective about the open SMTP relays that they want on their network. ASP.net has a solution, and I have a solution. The asp.net solution is that the web server where your application will eventually live can (will) have a single machine configuration for the smtp settings. Every application can override this setting in the web.config file, but should actually just comment out the < mailsettings > section. During development, however, this configuration is useful: < configuration > < system.net > < mailSettings > < smtp from= "admin@foo.bar" deliveryMethod= "SpecifiedPickupDirectory" > < specifiedPickupDirectory pickupDirectoryLocation= "C