netDumbster is a .Net Fake SMTP Server clone of the popular Dumbster (http://quintanasoft.com/dumbster/)netDumbster is based on the API of nDumbster (http://ndumbster.sourceforge.net/default.html) and the nice C# Email Server (CSES) written by Eric Daugherty. The following sample shows how to use netDumbster in a MbUnit (http://www.gallio.org/) test.using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;using Gallio.Framework;
using MbUnit.Framework;using netDumbster.smtp;namespace netDumbster.Test
{
Read more: Codeplex
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;using Gallio.Framework;
using MbUnit.Framework;using netDumbster.smtp;namespace netDumbster.Test
{
[TestFixture]
public class Tests
{
private static SimpleSmtpServer _Server;private Random _Rnd = new Random();public Tests(){log4net.Config.XmlConfigurator.Configure();}
private void SendMail(){
SendMail(false);
}
private void SendMail(bool smtpAuth){
SmtpClient client = new SmtpClient("localhost", _Server.Port);var mailMessage = new MailMessage("carlos@mendible.com", "karina@mendible.com", "test", "test tes test");
if (smtpAuth){
NetworkCredential credentials = new NetworkCredential("user", "pwd");client.Credentials = credentials;client.EnableSsl = false;
}
client.Send(mailMessage);
}
Read more: Codeplex
0 comments:
Post a Comment