views:

105

answers:

4

I'm trying to develop an app that sends email, and our internal network is locked down pretty tight, so I can't relay using our internal mail servers.

Has anyone ever used something like no-ip.com? Are there any other alternatives?

A: 

The usual answer is to run SMTP locally under IIS, but you need to be careful about who you're sending to. It might actually be better to send to your usual SMTP server and target only accounts within your domain.

Steven Sudit
Can't even do that, unfortunately.
chris
Wow. Ok, then technophile's answer is probably best.
Steven Sudit
+2  A: 

I would agree with the above...setup your own test SMTP server, and use that for your testing.

Here's some info to get you on the right track:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e4cf06f5-9a36-474b-ba78-3f287a2b88f2.mspx?mfr=true

http://www.cmsconnect.com/praetor/WebHelpG2/Chapter_2_-_Pre-installation_considerations/Configuring_the_SMTP_Server.htm

http://service1.symantec.com/support/ent-gate.nsf/docid/2007241920754398

Albert
+1 for providing reference.
Steven Sudit
A: 

You can save the email to disk:

#if DEBUG
smtpClient.PickupDirectoryLocation = "\\Path\\to\\save\\folder";
smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
smtpClient.Send(msg);
#endif
codekaizen
This works but I'm more comfortable with the app.config solution, since it's not tied to debug or release builds.
Steven Sudit
Yea, that's the better way... I had just forgot how to do the config trick.
codekaizen
+3  A: 

If you just need to check that the e-mails are being sent to the correct addresses and with the correct contents, the easiest way is to use a drop folder by editing the app or web.config file:

  <system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory" from="[email protected]">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\TestMailDrop"/>
      </smtp>
    </mailSettings>
  </system.net>

This will result in the e-mails being created as files in the specified directory. You can even then load the files and verify them as part of a unit test.

(As codekaizen points out, this can also be done in code if you don't mind modifying the code/hardcoding the drop folder and having the behavior differing in debug/release mode.)

technophile
+1 for making the best of a bad situation.
Steven Sudit
sounds like the best option for now - that, plus it's obviously time to put my resume up on careers.stackoverflow.com :)
chris
I'm going to restrict myself to technical advice here, instead of career advice. But, yes, if your employer wants you to do something and then works to stop you from doing it, you've got a problem.
Steven Sudit