Показаны сообщения с ярлыком smpt. Показать все сообщения
Показаны сообщения с ярлыком smpt. Показать все сообщения

среда, 12 января 2011 г.

Installing and Configuring Windows Server 2008 SMTP

Installing SMTP Server Feature on Windows 2008 is an easy process requiring only few steps to complete. On this article we will describe a step by step configuration and installation of the SMTP Server feature and how to enable the smtp to relay from local server.
Step 1:
Opening Server Manager Console and under Features select Add Features
Step 2:
Selecting SMTP Server option
Step 3:
Click on Install wait until finish and click close
Step 4:
Waiting for installation to finish and clicking on Close
Step 5:
Opening IIS 6.0 Manager under Administrative Tools -> Internet Information Services 6.0
Step 6:
Under [SMTP Virtual Server] second mouse click and properties
Step 7:
Select Relay under Access Tab
Step 8:
Select Only the list below and click on Add button
Step 9:
Enter IP Address 127.0.0.1 for relay
Step 10:
Sending a manual email through telnet to confirm everything working successfully. Telnet localhost 25 or telnet yourpublicip 25 and make sure you open the specific port on your firewall to be available to public.

пятница, 14 августа 2009 г.

How to utilize Google gmail server in your.NET Web & Windows Applications

It's true; gmail allows you to use their mail servers to send email from your applications. If you combine that with the ASP.NET System.Net.Mail.SmtpClient class, you are ready to use your free gmail account and server.

Here is the Google mail server info you need:

Mail Host: smtp.gmail.com

Port: 587

You can use this info to send email from any Web or Windows application:

How to use in ASP.NET Web Application:

· In your web.config file, Add the following configuration section:

<system.net>

<mailSettings>

<smtp from=your_gmail_email@gmail.com>

<network host="smtp.gmail.com"

password="your_gmail_password"

port="587"

userName="your_gmail_email@gmail.com"/>

smtp>

mailSettings>

system.net>

· Now from any where in your ASP.NET web application, you can send email using System.Net.Mail.SmtpClient as follows:

using System.Net.Mail;

...

SmtpClient mailClient = new SmtpClient();

mailClient.EnableSsl = true;

mailClient.Send(from, to, subject, body);

This is very useful in many ways, for example, when you want to get notified about certain events that happen on your site. In my other article: "Ever wanted to know when Google bot visits your site?" I utilize the code above to know when a certain visitor comes to my site, specifically in this case, Google's spider.

How to use in .NET Windows Application:

· From your Windows application, you will need to setup the Network Credentials. Here is the code:

using System.Net.Mail;

using System.Net;

...

SmtpClient mailClient = new SmtpClient(

"smtp.gmail.com", "587");

mailClient.EnableSsl = true;

NetworkCredential cred = new NetworkCredential(

"your_gmail_username",

"your_gmail_password");

mailClient.Credentials = cred;

mailClient.Send("from_me@gmail.com", "to_you@gmail.com",

"subject goes here", "email body goes here");

And that's it! Please use the above code responsively :)