我如何设置SMTP在Vista上,所以我可以使用System.Net.Mail?可以使用、如何设置、所以我、SMTP

由网友(低调Dé华丽)分享简介:据我了解有关于Vista的IIS中没有SMTP服务器。我工作的一个项目,该项目将需要我发送电子邮件。我想首先这是运行Vista旗舰版在我的发展中一些简单的原型。我没有连接到企业网络,我可以只使用一个Exchange服务器的某个地方。From what I understand there is no SMTP ser...

据我了解有关于Vista的IIS中没有SMTP服务器。我工作的一个项目,该项目将需要我发送电子邮件。我想首先这是运行Vista旗舰版在我的发展中一些简单的原型。我没有连接到企业网络,我可以只使用一个Exchange服务器的某个地方。

From what I understand there is no SMTP server in IIS on Vista. I am working on a project which will require me to send email. I'd like to start with some simple prototypes on my development box which is running Vista Ultimate. I'm not connected to a corporate network where I can just use an exchange server someplace.

我认识到,有几个的SMTP服务器,我可以安装,但我不知道该怎么做,一旦我安装一个。我知道怎么写了code发送电子邮件,但我不知道需要做使用SMTP服务器什么样的配置。

I realize that there are several smtp servers that I can install, but I'm not sure what to do once I install one. I know how to write the code to send the email, but I don't know what kind of configuration needs to be done to use the smtp server.

我想是做什么,一旦我得到安装在我的Vista中的SMTP服务器的明确说明。

What I'd like is a clear description of what to do once I get an smtp server installed on my Vista box.

谢谢!

更新:我下载了这个SMTP服务器: http://softstack.com/freesmtp.html

UPDATE: I downloaded this smtp server: http://softstack.com/freesmtp.html

下面就是我的code是这样的:

Here's what my code looks like:

class Program
{
    static void Main(string[] args)
    {
        MailMessage message = new MailMessage();    
        message.From = new MailAddress("tad@myconsoleapp.com");    
        message.To.Add(new MailAddress("terry.donaghe@gmail.com"));               
        //message.To.Add(new MailAddress("recipient3@foo.bar.com"));    
        //message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));    
        message.Subject = "This is my subject";    
        message.Body = "This is the content";    
        SmtpClient client = new SmtpClient("localhost");    
        client.Send(message);    
        Console.ReadLine();     
    }
}

当我有这样的SMTP服务器上运行,我执行我的控制台应用程序,它双手放在client.send行。 SMTP服务器看起来是这样的:

When I have this smtp server running and I execute my console app, it hands on the client.send line. The smtp server looks like this:

http://screencast.com/t/2B7jv0bE14

过了一会,client.send超时。

After a while the client.send times out.

任何想法什么错了?

谢谢!

推荐答案

正如你所知道的SMTP不再随Vista的(这是我关于Vista最大的抱怨之一)。正如你已经知道有很多选择在那里,如果你找到了一个好免费的发布链接。你如何配置它会probally取决于安装在服务器上。

As you know SMTP no longer ships with Vista (Which is one of my biggest complaints about Vista). As you already know there are many options out there, and if you found a good free one post a link to it. How you configure it will probally depend on the server you install.

我有一些试验的SMTP服务器发挥各地,以及所有那些我曾经开始听上的环回IP地址标准的SMTP端口。我相信这是默认MailSettings,并且不应进行任何改变。

I played around with some trial smtp servers, and all the ones I used started listening on the standard SMTP ports on the loopback IP Address. I believe this is the default MailSettings, and shouldn't require any changes.

我不再有任何SMTP服务器和现在用的拾取目录模式。这会导致邮件库输出文件,我可以再检查。

I no longer have any SMTP server and am using the Pickup Directory mode. This causes the mail library to output a file which I can then inspect.

要配置这个用在你的配置文件如下:

To configure this use the following in your config file:

<system.net>
	<mailSettings>
		<smtp deliveryMethod="SpecifiedPickupDirectory">
			<specifiedPickupDirectory
			  pickupDirectoryLocation="c:maildrop"/>
		</smtp>
	</mailSettings>
</system.net>

如果您希望将其配置为连接到端口25的本地主机上你会这样的SMTP部分:

If you want to configure it to connect to port 25 on your local host you would this for the SMTP section:

<smtp deliveryMethod="Network">
   <network defaultCredentials="true" host="localhost" port="25"/>
</smtp>

修改

特里问了一个很好的问题有关使用放置位置。我只能用这个测试,因为我们的生产服务器,我连接到​​SMTP服务器,并通过发送电子邮件;然而,某些SMTP服务器可以配置为观看目录,将拾取并在那里邮寄任何东西。

Edit

Terry asked a good question about using the drop location. I only use this for testing, as our production server has an SMTP server which I connect to, and send the email through; however, some SMTP servers can be configured to watch a directory and will pick up and mail anything in there.

我不觉得这个功能是为了仅用于测试使用,但它工作得很好。即获得生成的文件可以在不同的邮件客户端被打开,所以你可以看到他们将如何使它们。我相信他们的.eml文件,但我不记得了。

I don't think this feature was meant to be used only for testing but it works nicely. The files that get generated can be opened in various mail clients so you can see how they would render them. I belive they .eml files but I can't remember.

阅读全文

相关推荐

最新文章