Wednesday, June 20, 2012

What’s new today?

Just to keep some track and hope it might help somebody as well.

1. Not the first time that I ran into json model coming empty to MVC controller/action. I hope I’ll remember once that fields are not being populated by binder, only properties!

2. Was about to write my own Razor “engine” for generating emails from razor templates. But found this: Really cool, it makes it as easy as:

string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });

3. Found out that there is no SMTP in windows 7. Oh my! Installed this but still didn’t get to relay to anywhere, too closed environment. So the solution for dev machine was to use the following configuration for System.Net.Mail:

    <smtp deliveryMethod="SpecifiedPickupDirectory">
      <network host="localhost" />
      <specifiedPickupDirectory pickupDirectoryLocation="C:\Exchange" />

You’d say “is not that network element there by mistake?”. Not until the bug fix in .net 4.5 and you correctly using the disposable like:

 using (MailMessage message = new MailMessage(....))
    using (SmtpClient smtp = new SmtpClient())

 read more on ms connect.

Email body and subject are in base 64 in that folder stored file, so some online base64 encoder will come handy:

It is not the end of the day yet, but I hope those are only no-brainers that are left for the rest of it, lol.

No comments: