Showing posts with label SMTP. Show all posts
Showing posts with label SMTP. Show all posts

2016-03-02

Catching mails

When developing a solution, sometimes it is nice to be able to catch mails and store them somewhere in stead of potentially sending them to real customers.

In web.config or app.config, there is a setting that can accomplish that for you:

<system.net>
  <mailSettings>
    <smtp deliveryMethod="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\Mail"/>
    </smtp>
  </mailSettings>
</system.net>
 If you install an eml-viewer or maybe just a regular mail client, you can open and read the mails from the folder you specified.

Source:
http://stackoverflow.com/questions/567765/how-can-i-save-an-email-instead-of-sending-when-using-smtpclient

2009-08-24

Bare linefeeds in SMTP Messages, status 451

I was having a problem with mails that were not being sent as they were supposed to be, and the problem could be caused by the use of bare linefeeds in the message body.

A bare linefeed is a linefeed that has only a linefeed (LF = “\n” in C#/C++/Java, ASCII code 10 decimal) and no carriage return (CR = “\r”, ASCII code 13 decimal).

Internet e-mail standards forbid the use of bare linefeeds, and some mailservers will reject a mail using bare linefeeds, with the status 451 (other mailservers wil accept them and just correct the mistake itself).

In stead of using bare linefeeds, a linefeed should always come with a carriage return (CR + LF = “\r\n”).

Read the full story at http://www.dylanbeattie.net/docs/iis6_bare_linefeed.html.