<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Exchange Server Pro &#187; SMTP</title>
	<atom:link href="http://exchangeserverpro.com/tag/smtp/feed" rel="self" type="application/rss+xml" />
	<link>http://exchangeserverpro.com</link>
	<description>Microsoft Exchange Server News - Tips - Tutorials</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:00:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to Send SMTP Email Using PowerShell (Part 3)</title>
		<link>http://exchangeserverpro.com/powershell-send-html-email</link>
		<comments>http://exchangeserverpro.com/powershell-send-html-email#comments</comments>
		<pubDate>Mon, 24 Oct 2011 14:19:29 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=4191</guid>
		<description><![CDATA[Learn how to add HTML message body content to emails sent via PowerShell scripts.]]></description>
			<content:encoded><![CDATA[<p>In the last article in this series I showed you <a href="http://exchangeserverpro.com/powershell-email-message-body">how to add message body content to emails sent from PowerShell scripts</a>.</p>
<ul>
<li><a href="http://exchangeserverpro.com/powershell-how-to-send-email">Part 1 &#8211; How to Send SMTP Email Using PowerShell</a></li>
<li><a href="http://exchangeserverpro.com/powershell-email-message-body">Part 2 - How to Add a Message Body to Emails Sent from Scripts</a></li>
<li><strong>Part 3 - How to Add a HTML Message Body to Emails Sent from Scripts</strong></li>
<li><a href="http://exchangeserverpro.com/powershell-html-email-formatting">Part 4 - How to Create Formatted HTML Output from Scripts</a></li>
</ul>
<p>In this article we&#8217;ll take it a step further by adding a HTML message body to an email.</p>
<p>For this to work we&#8217;ll be using an <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage(v=VS.100).aspx">System.Net.Mail.MailMessage</a> .NET object. This is basically a message object that can be sent via the <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx">SmtpClient</a> .NET object that we used in the previous articles. The benefit of using this object in a script is that it can be used to create HTML email messages.</p>
<p>To create the script we can start with similar variables to last time.</p>
<pre>$smtpServer = "ho-ex2010-caht1.exchangeserverpro.net"
$smtpFrom = "reports@exchangeserverpro.net"
$smtpTo = "administrator@exchangeserverpro.net"
$messageSubject = "List of Exchange Servers"</pre>
<p>Next we create the new MailMessage object using the variables above as the To and From addresses, and then set the message subject as well.</p>
<pre>$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject</pre>
<p>Now comes the important bit, setting the message body to be HTML.</p>
<pre>$message.IsBodyHTML = $true</pre>
<p>Now all we need is some HTML content to go into the message body. As an example let&#8217;s just get a list of Exchange servers and their server roles.</p>
<pre>$message.Body = Get-ExchangeServer | Select-Object Name,ServerRole | ConvertTo-Html</pre>
<p>All I needed to do above is run <a href="http://technet.microsoft.com/en-us/library/bb123873.aspx">Get-ExchangeServer</a>, pipe the output into a <a href="http://technet.microsoft.com/en-us/library/dd315291.aspx">Select-Object</a> command to grab just the server name and roles, and then pipe that into the <a href="http://technet.microsoft.com/en-us/library/ee156817.aspx">ConvertTo-Html</a> command.</p>
<p>The final step is to create the SmtpClient object and send the mail message.</p>
<pre>$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)</pre>
<p>The result is an email that looks similar to this.</p>
<p><img class="aligncenter size-full wp-image-4192" title="powershell-send-html-email" src="http://exchangeserverpro.com/wp-content/uploads/2011/10/powershell-send-html-email.jpg" alt="" width="500" height="365" /></p>
<p>Here is the complete example script.</p>
<pre>$smtpServer = "ho-ex2010-caht1.exchangeserverpro.net"
$smtpFrom = "reports@exchangeserverpro.net"
$smtpTo = "administrator@exchangeserverpro.net"
$messageSubject = "List of Exchange Servers"

$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.IsBodyHTML = $true

$message.Body = Get-ExchangeServer | Select-Object Name,ServerRole | ConvertTo-Html

$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)</pre>
<p>As you can see this is a pretty simple technique that can be used to easily create basic HTML email messages.</p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/powershell-email-message-body" title="How to Send SMTP Email Using PowerShell (Part 2)">How to Send SMTP Email Using PowerShell (Part 2)</a></li><li><a href="http://exchangeserverpro.com/powershell-html-email-formatting" title="How to Send SMTP Email Using PowerShell (Part 4)">How to Send SMTP Email Using PowerShell (Part 4)</a></li><li><a href="http://exchangeserverpro.com/powershell-how-to-send-email" title="How to Send SMTP Email Using PowerShell (Part 1)">How to Send SMTP Email Using PowerShell (Part 1)</a></li><li><a href="http://exchangeserverpro.com/test-mailflow-exchange-2003-servers" title="Using Test-Mailflow with Exchange 2003 Servers">Using Test-Mailflow with Exchange 2003 Servers</a></li><li><a href="http://exchangeserverpro.com/set-automated-exchange-2010-database-backup-alert-email" title="How to Set Up an Automated Exchange 2010 Database Backup Alert Email">How to Set Up an Automated Exchange 2010 Database Backup Alert Email</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/powershell-send-html-email">How to Send SMTP Email Using PowerShell (Part 3)</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/powershell-send-html-email/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Send SMTP Email Using PowerShell (Part 2)</title>
		<link>http://exchangeserverpro.com/powershell-email-message-body</link>
		<comments>http://exchangeserverpro.com/powershell-email-message-body#comments</comments>
		<pubDate>Sun, 09 Oct 2011 12:30:15 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=4161</guid>
		<description><![CDATA[Learn simple techniques for adding message body content to emails sent via PowerShell scripts.]]></description>
			<content:encoded><![CDATA[<p>In the last part of this series we looked at simple techniques for <a href="http://exchangeserverpro.com/powershell-how-to-send-email">sending email from PowerShell</a>.</p>
<ul>
<li><a href="http://exchangeserverpro.com/powershell-how-to-send-email">Part 1 &#8211; How to Send SMTP Email Using PowerShell</a></li>
<li><strong>Part 2 - How to Add a Message Body to Emails Sent from Scripts</strong></li>
<li><a href="http://exchangeserverpro.com/powershell-send-html-email">Part 3 - How to Add a HTML Message Body to Emails Sent from Scripts</a></li>
<li><a href="http://exchangeserverpro.com/powershell-html-email-formatting">Part 4 - How to Create Formatted HTML Output from Scripts</a></li>
</ul>
<p>In this article we&#8217;ll take a closer look at how you can create the email message body for emails that you are sending via PowerShell.</p>
<p>In the last article I demonstrated a simple PowerShell script for sending emails that contained the following code, using the <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx">SmtpClient</a> .NET object .</p>
<pre>#
#.SYNOPSIS
#Sends SMTP email via the Hub Transport server
#
#.EXAMPLE
#.\Send-Email.ps1 -To "administrator@exchangeserverpro.net" -Subject "Test email" -Body "This is a test"
#

param(
[string]$to,
[string]$subject,
[string]$body
)

$smtpServer = "ho-ex2010-caht1.exchangeserverpro.net"
$smtpFrom = "reports@exchangeserverpro.net"
$smtpTo = $to
$messageSubject = $subject
$messageBody = $body

$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)</pre>
<p>Now let&#8217;s build on that example by adding more content to the message body of the emails.</p>
<h2>Using Command Output as Email Message Content with PowerShell</h2>
<p>When running this script anything that we specify with the -Body parameter will be the message body of the email. It could be a text string, or it could even be the output from another PowerShell command. For example:</p>
<pre>[PS] C:\Scripts&gt;.\Send-Email.ps1 -To "administrator@exchangeserverpro.net" -Subject "List of Exchange Servers" -Body (Get-ExchangeServer)</pre>
<p>The command above would produce an email that looks like this:</p>
<p><img class="aligncenter size-full wp-image-4162" title="powershell-email-message-body-01" src="http://exchangeserverpro.com/wp-content/uploads/2011/10/powershell-email-message-body-01.jpg" alt="" width="580" height="239" /></p>
<p>Neat trick, but notice how the list of Exchange servers appears as all one string that wraps over two lines? Wouldn&#8217;t it be nicer to see the server names displayed in an easier to read list format? Let&#8217;s take a look at how you can achieve that.</p>
<pre>[PS] C:\Scripts&gt;[string]$emailbody = ""

[PS] C:\Scripts&gt;$servers = Get-ExchangeServer

[PS] C:\Scripts&gt;foreach ($server in $servers) {$emailbody = $emailbody + $server.name + "`r`n"}

[PS] C:\Scripts&gt;.\Send-Email.ps1 -To "administrator@exchangeserverpro.net" -Subject "List of Exchange Servers" -Body $emailbody</pre>
<p>So what did I do there? Here are the steps I just followed:</p>
<ol>
<li>Declare a variable <strong>$emailbody</strong> as type <strong>string</strong>. This will be the variable that is passed to the script to be the message body of the email that gets sent.</li>
<li>Used the <a href="http://technet.microsoft.com/en-us/library/bb123873.aspx">Get-ExchangeServer</a> cmdlet to retrieve a list of the Exchange servers in the organization into an array of <strong>$servers</strong>.</li>
<li>Looped through the array using the <a href="http://technet.microsoft.com/en-us/library/dd347608.aspx">ForEach-Object</a> (abbreviated to &#8220;foreach&#8221;) cmdlet and appended each server name to the $emailbody string, including (and this is the important part) a <strong>carriage return</strong> after each server name.</li>
<li>Ran the script using the $emailbody variable for the -Body script parameter.</li>
</ol>
<p>The result is an email that looks like this; much better don&#8217;t you agree?</p>
<p><img class="aligncenter size-full wp-image-4163" title="powershell-email-message-body-02" src="http://exchangeserverpro.com/wp-content/uploads/2011/10/powershell-email-message-body-02.jpg" alt="" width="580" height="302" /></p>
<p>Now this is only a demonstration. In reality you probably aren&#8217;t going to want to send yourself an email with a list of your Exchange servers, at least not very often.</p>
<p>However you can use the same techniques I&#8217;ve just demonstrated to build scripts that email you any command or script output, such as a <a href="http://exchangeserverpro.com/how-to-find-exchange-server-2010-mailboxes-without-storage-quotas">list of mailboxes with no storage quotas</a> that you have emailed to yourself automatically each month.</p>
<h2>Using File Contents as Email Message Content with PowerShell</h2>
<p>Another technique for getting content for the message body of an email sent via PowerShell is to use the contents of a file.</p>
<p>For example, I run continuous pings between certain servers to detect any network interruptions that may be occurring. An entry is written to a log file any time a ping times out. Every day I want to receive an email with the results of the previous day&#8217;s ping monitoring, so I can do that using a script like this.</p>
<pre>#
#.SYNOPSIS
#Sends daily dropped ping report
#
#.EXAMPLE
#.\Send-DroppedPingReport.ps1
#

$smtpServer = "ho-ex2010-caht1.exchangeserverpro.net"
$smtpFrom = "reports@exchangeserverpro.net"
$smtpTo = "administrator@exchangeserverpro.net"
$messageSubject = "Dropped ping report"

[string]$messagebody = ""

$logs = Get-Content C:\Logs\droppedpings.log

foreach ($log in $logs )
{
	$messagebody = $messagebody + $log + "`r`n"
}

$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)</pre>
<p>This is the same technique that was used earlier to create an array and loop through it to add the carriage returns so that the email is formatted nicely. The main difference is the use of <a href="http://technet.microsoft.com/en-us/library/ee176843.aspx">Get-Content</a> instead of Get-ExchangeServer.</p>
<p><img class="aligncenter size-full wp-image-4164" title="powershell-email-message-body-03" src="http://exchangeserverpro.com/wp-content/uploads/2011/10/powershell-email-message-body-03.jpg" alt="" width="580" height="254" /></p>
<p>As you can see it is very simple to create useful, informative emails that are sent by your PowerShell scripts.</p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/powershell-send-html-email" title="How to Send SMTP Email Using PowerShell (Part 3)">How to Send SMTP Email Using PowerShell (Part 3)</a></li><li><a href="http://exchangeserverpro.com/powershell-html-email-formatting" title="How to Send SMTP Email Using PowerShell (Part 4)">How to Send SMTP Email Using PowerShell (Part 4)</a></li><li><a href="http://exchangeserverpro.com/powershell-how-to-send-email" title="How to Send SMTP Email Using PowerShell (Part 1)">How to Send SMTP Email Using PowerShell (Part 1)</a></li><li><a href="http://exchangeserverpro.com/test-mailflow-exchange-2003-servers" title="Using Test-Mailflow with Exchange 2003 Servers">Using Test-Mailflow with Exchange 2003 Servers</a></li><li><a href="http://exchangeserverpro.com/set-automated-exchange-2010-database-backup-alert-email" title="How to Set Up an Automated Exchange 2010 Database Backup Alert Email">How to Set Up an Automated Exchange 2010 Database Backup Alert Email</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/powershell-email-message-body">How to Send SMTP Email Using PowerShell (Part 2)</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/powershell-email-message-body/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Send SMTP Email Using PowerShell (Part 1)</title>
		<link>http://exchangeserverpro.com/powershell-how-to-send-email</link>
		<comments>http://exchangeserverpro.com/powershell-how-to-send-email#comments</comments>
		<pubDate>Thu, 29 Sep 2011 13:12:00 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=3921</guid>
		<description><![CDATA[This article demonstrates a few simple techniques for sending email messages via SMTP using both PowerShell 1.0 and 2.0.]]></description>
			<content:encoded><![CDATA[<p>A useful technique for <a href="http://exchangeserverpro.com">Exchange Server</a> administrators is to be able to send email messages via SMTP from <a href="http://exchangeserverpro.com/review-microsoft-exchange-2010-powershell-cookbook">PowerShell</a>. In this series of articles I will take you through different scripting techniques for sending email from your scripts.</p>
<ul>
<li><strong>Part 1 &#8211; How to Send SMTP Email Using PowerShell</strong></li>
<li><a href="http://exchangeserverpro.com/powershell-email-message-body">Part 2 - How to Add a Message Body to Emails Sent from Scripts</a></li>
<li><a href="http://exchangeserverpro.com/powershell-send-html-email">Part 3 - How to Add a HTML Message Body to Emails Sent from Scripts</a></li>
<li><a href="http://exchangeserverpro.com/powershell-html-email-formatting">Part 4 - How to Create Formatted HTML Output from Scripts</a></li>
</ul>
<p>There are a few different ways to do this, depending on the version of PowerShell installed on your computer or server. You can check the version number by typing <strong>$host</strong> in a PowerShell window.</p>
<p>PowerShell 1.0 will show this result:</p>
<pre>PS C:\&gt; $host

Name             : ConsoleHost
Version          : 1.0.0.0</pre>
<p>PowerShell 2.0 will show this result:</p>
<pre>PS C:\&gt; $host

Name             : ConsoleHost
Version          : 2.0</pre>
<p>Let&#8217;s take a look at how we can send SMTP email using each version of PowerShell.</p>
<h2>Sending SMTP Email with PowerShell 1.0</h2>
<p>For PowerShell 1.0 we can send mail by running these commands.</p>
<pre>PS C:\&gt; $smtp = New-Object Net.Mail.SmtpClient("ho-ex2010-caht1.exchangeserverpro.net")
PS C:\&gt; $smtp.Send("reports@exchangeserverpro.net","administrator@exchangeserverpro.net","Test Email","This is a test")</pre>
<p>So what did we just do there? Let&#8217;s break it down.</p>
<ol>
<li>Created a new instance of a .NET object of class <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx">SmtpClient</a>, connected to the SMTP server ho-ex2010-caht1 (a Hub Transport server)</li>
<li>Used the <a href="http://msdn.microsoft.com/en-us/library/h1s04he7.aspx">Send method</a> of the object to send an email message with the following:</li>
<ul>
<li>From address of &#8220;reports@exchangeserverpro.net&#8221;</li>
<li>To address of &#8220;administrator@exchangeserverpro.net</li>
<li>Subject of &#8220;Test Email&#8221;</li>
<li>Body of &#8220;This is a test&#8221;</li>
</ul>
</ol>
<p><img class="aligncenter size-full wp-image-4144" title="powershell-send-smtp-email-ps1-01" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/powershell-send-smtp-email-ps1-01.png" alt="" width="554" height="182" /></p>
<p>That works fine, though perhaps a bit cumbersome to type it out every time. Instead what we could do is create a script to send SMTP email using PowerShell 1.0.</p>
<pre>#
#.SYNOPSIS
#Sends SMTP email via the Hub Transport server
#
#.EXAMPLE
#.\Send-Email.ps1 -To "administrator@exchangeserverpro.net" -Subject "Test email" -Body "This is a test"
#

param(
[string]$to,
[string]$subject,
[string]$body
)

$smtpServer = "ho-ex2010-caht1.exchangeserverpro.net"
$smtpFrom = "reports@exchangeserverpro.net"
$smtpTo = $to
$messageSubject = $subject
$messageBody = $body

$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)</pre>
<p>We can save that code as Send-Email.ps1 and run it from the PowerShell window.</p>
<pre>PS C:\Scripts&gt; .\Send-Email.ps1 -To "administrator@exchangeserverpro.net" -Subject "Test email" -Body "This is a test"</pre>
<p>Less typing required, especially when you hard-code some of the variables such as the From address and SMTP server.</p>
<h2>Sending SMTP Email with PowerShell 2.0</h2>
<p>PowerShell 2.0 makes life a little easier thanks to the built in cmdlet <a href="http://technet.microsoft.com/en-us/library/dd347693.aspx">Send-MailMessage</a>. To send the same email as the above example we would run this command:</p>
<pre>PS C:\&gt; Send-MailMessage -From "reports@exchangeserverpro.net" -To "administrator@exchangeserverpro.net" -Subject "Test email" -Body "This is a test email"</pre>
<p>One of the first things you might notice in the command above is that no SMTP server was specified. Send-MailMessage does have a -SmtpServer parameter, but if you don&#8217;t specify one it will just use the <a href="http://technet.microsoft.com/en-us/library/dd347731.aspx">$PSEmailServer preference variable</a> instead. This can be set for the session by running the following command:</p>
<pre>PS C:\&gt; $PSEmailServer = "ho-ex2010-caht1.exchangeserverpro.net"</pre>
<p>Another point to note with Send-MailMessage is that is uses authenticated SMTP connections. By default it will use the credentials of the user executing the command. So you need to make sure you&#8217;re using an SMTP server that either:</p>
<ul>
<li>Permits that authenticated user credential to send email messages via SMTP</li>
<li>Accepts anonymous SMTP/relay for the IP address of the sending host (you can see how to <a href="http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010">configure a relay connector for Exchange here</a>)</li>
</ul>
<p>Those are just a few simple examples of how to send email using SMTP and PowerShell 1.0 or 2.0.</p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/powershell-send-html-email" title="How to Send SMTP Email Using PowerShell (Part 3)">How to Send SMTP Email Using PowerShell (Part 3)</a></li><li><a href="http://exchangeserverpro.com/powershell-email-message-body" title="How to Send SMTP Email Using PowerShell (Part 2)">How to Send SMTP Email Using PowerShell (Part 2)</a></li><li><a href="http://exchangeserverpro.com/test-mailflow-exchange-2003-servers" title="Using Test-Mailflow with Exchange 2003 Servers">Using Test-Mailflow with Exchange 2003 Servers</a></li><li><a href="http://exchangeserverpro.com/set-automated-exchange-2010-database-backup-alert-email" title="How to Set Up an Automated Exchange 2010 Database Backup Alert Email">How to Set Up an Automated Exchange 2010 Database Backup Alert Email</a></li><li><a href="http://exchangeserverpro.com/powershell-script-check-exchange-2010-database-backups" title="PowerShell Script: Check Exchange 2010 Database Backups">PowerShell Script: Check Exchange 2010 Database Backups</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/powershell-how-to-send-email">How to Send SMTP Email Using PowerShell (Part 1)</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/powershell-how-to-send-email/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Email Fundamentals: How to Read Email Message Headers</title>
		<link>http://exchangeserverpro.com/how-to-read-email-message-headers</link>
		<comments>http://exchangeserverpro.com/how-to-read-email-message-headers#comments</comments>
		<pubDate>Mon, 19 Sep 2011 11:15:29 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Email Fundamentals]]></category>
		<category><![CDATA[Headers]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=4043</guid>
		<description><![CDATA[How to read the headers of an email message to get useful information for diagnosing problems.]]></description>
			<content:encoded><![CDATA[<p>The headers of an email message contain very useful information for <a href="http://exchangeserverpro.com">Exchange Server</a> administrators. Header information includes such things as which email servers were involved in the transmission of the message, and whether the email message was scanned for spam or viruses.</p>
<p>This is useful both for internal and external email messages. In one recent real world example we used message headers to diagnose which hop along the email route was causing large delays for emails into the organization.</p>
<p>To view the message headers in Outlook 2010 click on the arrow next to Tags in the ribbon menu.</p>
<p><img class="aligncenter size-full wp-image-4159" title="outlook-2010-show-email-headers-03" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/outlook-2010-show-email-headers-03.jpg" alt="" width="580" height="237" /></p>
<p>To view the message headers in Outlook 2007 click on the arrow next to Options in the ribbon menu.</p>
<p><img class="aligncenter size-full wp-image-4044" title="outlook-2010-show-email-headers-01" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/outlook-2010-show-email-headers-01.jpg" alt="" width="580" height="254" /></p>
<p>The message options will appear with the header information towards the bottom.</p>
<p><img class="aligncenter size-full wp-image-4045" title="outlook-2010-show-email-headers-02" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/outlook-2010-show-email-headers-02.jpg" alt="" width="500" height="431" /></p>
<p>I usually find it easier to copy the header text into Notepad for viewing.</p>
<p><img class="aligncenter size-full wp-image-4046" title="message-header-01" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/message-header-01.jpg" alt="" width="580" height="380" /></p>
<p>So let&#8217;s take a look at some of the header information that is useful to us. First there is the basic information about the email message itself.</p>
<p><img class="aligncenter size-full wp-image-4047" title="message-header-02" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/message-header-02.jpg" alt="" width="499" height="68" /></p>
<p>Then there are the email servers that the message passed through on it&#8217;s way to the destination. To follow these in order start at the bottom and read upwards.</p>
<p><img class="aligncenter size-full wp-image-4048" title="message-header-03" src="http://exchangeserverpro.com/wp-content/uploads/2011/09/message-header-03.jpg" alt="" width="589" height="277" /></p>
<p>These lines are generally in the following format:</p>
<blockquote><p>Received: from <strong>servername (IP address)</strong> by<strong> servername (IP address)</strong> with <strong>MTA-name</strong>; <strong>timestamp</strong></p></blockquote>
<p>When a message passes over several hops this can get a bit confusing to read. So I like to break out each entry and tidy them up into a readable format. I usually get something more like this:</p>
<blockquote><p>1. ironport1-mx.cbr1.mail-filtering.com.au (203.88.115.241) -&gt; HO-EX2010-CAHT1.exchangeserverpro.net (10.1.1.14); Mon, 19 Sep 2011 19:41:57 +1000</p>
<p>2. ju001lcs02.dfw.the-server.net.au ([175.107.191.11]) -&gt; ironport1-mta.cbr1.mail-filtering.com.au with ESMTP; 19 Sep 2011 19:41:43 +1000</p>
<p>3. [209.85.213.177] (helo=mail-yx0-f177.google.com) -&gt; ju001lcs02.dfw.the-server.com.au; Mon, 19 Sep 2011 19:41:42 +1000</p>
<p>4. yxi11; Mon, 19 Sep 2011 02:41:38 -0700 (PDT)</p>
<p>5. 10.68.5.133; Mon, 19 Sep 2011 02:41:38 -0700 (PDT)</p>
<p>6. 10.68.43.230; Mon, 19 Sep 2011 02:41:38 -0700 (PDT)</p></blockquote>
<p>To me that is just more readable. You can take it a step further by converting timestamps into the same time zone, which makes it a little easier to identify any major delays as the message was transmitted between servers.</p>
<p>As you can see by learning to view and understand message headers you gain a much deeper understand of how email messages are flowing between senders and recipients, which will help you a lot during troubleshooting situations.</p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/powershell-send-html-email" title="How to Send SMTP Email Using PowerShell (Part 3)">How to Send SMTP Email Using PowerShell (Part 3)</a></li><li><a href="http://exchangeserverpro.com/powershell-email-message-body" title="How to Send SMTP Email Using PowerShell (Part 2)">How to Send SMTP Email Using PowerShell (Part 2)</a></li><li><a href="http://exchangeserverpro.com/powershell-how-to-send-email" title="How to Send SMTP Email Using PowerShell (Part 1)">How to Send SMTP Email Using PowerShell (Part 1)</a></li><li><a href="http://exchangeserverpro.com/how-to-send-email-via-telnet" title="Email Fundamentals: How to Send Email via Telnet">Email Fundamentals: How to Send Email via Telnet</a></li><li><a href="http://exchangeserverpro.com/resolving-anonymous-mail-gal-exchange-server-2010" title="Resolving Anonymous Mail to the GAL with Exchange Server 2010">Resolving Anonymous Mail to the GAL with Exchange Server 2010</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/how-to-read-email-message-headers">Email Fundamentals: How to Read Email Message Headers</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/how-to-read-email-message-headers/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Email Fundamentals: How to Send Email via Telnet</title>
		<link>http://exchangeserverpro.com/how-to-send-email-via-telnet</link>
		<comments>http://exchangeserverpro.com/how-to-send-email-via-telnet#comments</comments>
		<pubDate>Wed, 10 Aug 2011 12:30:00 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[Telnet]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=3919</guid>
		<description><![CDATA[How to use Telnet and the Windows command line to sent an SMTP email message.]]></description>
			<content:encoded><![CDATA[<p>This is one of the essential troubleshooting tricks that an Exchange administrator needs to know, sending an email using Telnet from the command line.</p>
<p>Let&#8217;s say you&#8217;ve just <a href="http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010">configured a relay connector</a> and want to test it from the server that you wish to allow relay from before you let that server&#8217;s owner know that it is all set up for them. Or perhaps you want to quickly test whether a another email server on the internet is accepting mail from your network.</p>
<p>For just about any scenario where you want to quickly test SMTP knowing this method is very useful.</p>
<p><em>Note: this technique requires the Telnet client to be installed on the computer you&#8217;re running the test from. For Windows XP and Windows Server 2003 it will already be installed, but Windows 7 and Windows Server 2008 need to install it first.</em></p>
<h2>Installing the Telnet Client for Windows 7</h2>
<p>To install the Telnet client on a Windows 7 computer use these steps.</p>
<ol>
<li>Open the Control Panel</li>
<li>Click on Programs</li>
<li>Click on Turns Windows Features on or off</li>
<li>Scroll down the list until you see Telnet Client, and tick that box</li>
<li>Click OK and close the Control Panel</li>
</ol>
<h2>Installing the Telnet Client for Windows Server 2008</h2>
<p>To install the Telnet client on a Windows Server 2008 computer open a command prompt and run the following command.</p>
<pre>C:\&gt;servermanagercmd -i telnet-client
.........

Start Installation...
[Installation] Succeeded: [Telnet Client].

Success: Installation succeeded.</pre>
<h2>Installing the Telnet Client for Windows Server 2008 R2</h2>
<p>To install the Telnet client on a Windows Server 2008 R2 computer open a PowerShell window and run the following command.</p>
<pre>PS C:\&gt; Import-Module servermanager
PS C:\&gt; Add-WindowsFeature telnet-client

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True    No             Success   {Telnet Client}</pre>
<h2>Sending Email from the Command Line via Telnet</h2>
<p>Open a command prompt and use Telnet to connect to the remote email server on port 25.</p>
<pre>C:\&gt;telnet esp-ho-ex2010a 25</pre>
<p>If Telnet is able to connect to the remote server you should see its welcome banner.</p>
<pre>220 ESP-HO-EX2010A.exchangeserverpro.net Microsoft ESMTP MAIL Service ready at T
ue, 9 Aug 2011 22:00:04 +1000</pre>
<p>The first command to send is the HELO command. Some email servers will accept HELO on its own, others will require you to also provide a host or domain name along with it.</p>
<pre>helo test.com
250 ESP-HO-EX2010A.exchangeserverpro.net Hello [10.0.1.11]</pre>
<p>Next use the MAIL FROM command to tell the remote server who the email is from.</p>
<pre>mail from: test@test.com
250 2.1.0 Sender OK</pre>
<p>Now use the RCPT TO command to tell the remote server who to deliver the email to.</p>
<pre>rcpt to: alan.reid@exchangeserverpro.net
250 2.1.5 Recipient OK</pre>
<p>The final step for the bare minimum set of commands is the DATA command.</p>
<pre>data
354 Start mail input; end with .</pre>
<p>If you just want to send a blank message type a period &#8220;.&#8221; and press enter. Otherwise you can set a subject line for the message if you like. Use SUBJECT and then type your subject line, and press enter.</p>
<pre>subject: this is a test message</pre>
<p>Type any text you want to include with the message, press enter, and then finally type a period &#8220;.&#8221; and press enter to send the email.</p>
<pre>sending a test message via telnet
.
250 2.6.0  [InternalId=320] Queued mail for delivery</pre>
<p>If the message was queued for delivery then it has been accepted by the server. If this is an Exchange server that you control then you can use message tracking to troubleshoot further if the message doesn&#8217;t make it to the inbox that you were expecting.</p>
<p>Type the QUIT command to terminate the connection when you&#8217;re done.</p>
<h2>SMTP Status Codes</h2>
<p>You may notice along the way that after typing commands you see responses from the server starting with &#8220;250&#8243;.</p>
<p>250 is a good thing, and there are a lot of other <a href="http://support.microsoft.com/kb/284204">SMTP status codes</a> you&#8217;ll encounter the more you use this technique. For example an email server may deny your attempt to relay mail between two domains.</p>
<pre>550 5.7.1 Unable to relay</pre>
<p>Or you may encounter an email server that is explicitly blocking email from your domain.</p>
<pre>554 5.1.0 Sender denied</pre>
<p>There are a lot of different scenarios you might encounter here, and thankfully the SMTP status codes will help you troubleshoot them.</p>
<p>Now that you understand how to send email using Telnet and the command line I hope you find this technique very useful in the future.</p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/install-telnet-on-windows-server-2008" title="Install telnet on Windows Server 2008">Install telnet on Windows Server 2008</a></li><li><a href="http://exchangeserverpro.com/powershell-send-html-email" title="How to Send SMTP Email Using PowerShell (Part 3)">How to Send SMTP Email Using PowerShell (Part 3)</a></li><li><a href="http://exchangeserverpro.com/powershell-email-message-body" title="How to Send SMTP Email Using PowerShell (Part 2)">How to Send SMTP Email Using PowerShell (Part 2)</a></li><li><a href="http://exchangeserverpro.com/powershell-how-to-send-email" title="How to Send SMTP Email Using PowerShell (Part 1)">How to Send SMTP Email Using PowerShell (Part 1)</a></li><li><a href="http://exchangeserverpro.com/how-to-read-email-message-headers" title="Email Fundamentals: How to Read Email Message Headers">Email Fundamentals: How to Read Email Message Headers</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/how-to-send-email-via-telnet">Email Fundamentals: How to Send Email via Telnet</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/how-to-send-email-via-telnet/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Resolving Anonymous Mail to the GAL with Exchange Server 2010</title>
		<link>http://exchangeserverpro.com/resolving-anonymous-mail-gal-exchange-server-2010</link>
		<comments>http://exchangeserverpro.com/resolving-anonymous-mail-gal-exchange-server-2010#comments</comments>
		<pubDate>Wed, 13 Apr 2011 12:36:07 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[GAL]]></category>
		<category><![CDATA[Hub Transport]]></category>
		<category><![CDATA[Receive Connectors]]></category>
		<category><![CDATA[Relay]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=3264</guid>
		<description><![CDATA[You may encounter an issue where the emails that end users receive show the SMTP address of the sender instead of the more friendly display name configured on the user mailbox that has that SMTP address.]]></description>
			<content:encoded><![CDATA[<p>It is fairly common in Exchange Server 2010 environments for there to be applications or devices that send email to users. These are usually configured to <a title="How to Configure a Relay Connector for Exchange Server 2010" href="http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010">relay email messages using an SMTP connection to a Hub Transport server</a>. They almost never authenticate their SMTP session, so are considered anonymous senders by Exchange 2010.</p>
<p>In this scenario you may encounter an issue where the emails that end users receive show the SMTP address of the sender instead of the more friendly display name configured on the user mailbox that has that SMTP address.</p>
<p>For example an email from a scanner device will appear like this.</p>
<p><img class="aligncenter size-full wp-image-3265" title="exchange-2010-resolve-anonymous-email-01" src="http://exchangeserverpro.com/wp-content/uploads/2011/04/exchange-2010-resolve-anonymous-email-01.png" alt="" width="600" height="147" /></p>
<p>This will occur if the Receive Connector on the Hub Transport server is accepting anonymous email. Receive Connectors are not configured this way by default but many Exchange administrators enable it because it is the simplest way to allow applications or devices to send emails to internal recipients.</p>
<p><img class="aligncenter size-full wp-image-3266" title="exchange-2010-resolve-anonymous-email-02" src="http://exchangeserverpro.com/wp-content/uploads/2011/04/exchange-2010-resolve-anonymous-email-02.png" alt="" width="444" height="185" /></p>
<p>To enable Exchange Server 2010 to resolve the anonymous emails you need to configure the Authentication settings for the Receive Connector to enable the Externally Secured option.</p>
<p><img class="aligncenter size-full wp-image-3267" title="exchange-2010-resolve-anonymous-email-03" src="http://exchangeserverpro.com/wp-content/uploads/2011/04/exchange-2010-resolve-anonymous-email-03.png" alt="" width="444" height="247" /></p>
<p>However this is not possible for the Default Receive Connector due to the other Authentication settings that are already enabled.</p>
<p><img class="aligncenter size-full wp-image-3268" title="exchange-2010-resolve-anonymous-email-04" src="http://exchangeserverpro.com/wp-content/uploads/2011/04/exchange-2010-resolve-anonymous-email-04.png" alt="" width="600" height="120" /></p>
<p>Instead what you can do is <a title="How to Configure a Relay Connector for Exchange Server 2010" href="http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010">create a relay connector for Exchange Server 2010</a> following the instructions <a title="How to Configure a Relay Connector for Exchange Server 2010" href="http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010">here</a>. Whether you restrict it to certain sender IP&#8217;s or allow your entire private network to use the relay connector is up to you.</p>
<p>Emails sent from devices using the new Receive Connector will resolve the name correctly from the GAL now.</p>
<p><img class="aligncenter size-full wp-image-3269" title="exchange-2010-resolve-anonymous-email-05" src="http://exchangeserverpro.com/wp-content/uploads/2011/04/exchange-2010-resolve-anonymous-email-05.png" alt="" width="600" height="178" /></p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/migrate-relay-connector-exchange-server-2007-2010" title="How to Migrate a Relay Connector from Exchange Server 2007 to 2010">How to Migrate a Relay Connector from Exchange Server 2007 to 2010</a></li><li><a href="http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010" title="How to Configure a Relay Connector for Exchange Server 2010">How to Configure a Relay Connector for Exchange Server 2010</a></li><li><a href="http://exchangeserverpro.com/exchange-2007-2010-infinite-loops-internal-relay-domains" title="Avoiding Infinite Loops with Internal Relay Domains in Exchange 2007/2010">Avoiding Infinite Loops with Internal Relay Domains in Exchange 2007/2010</a></li><li><a href="http://exchangeserverpro.com/review-codetwo-exchange-rules-pro" title="Review of CodeTwo Exchange Rules Pro">Review of CodeTwo Exchange Rules Pro</a></li><li><a href="http://exchangeserverpro.com/exchange-20072010-transport-rule-logging" title="Exchange 2007/2010 Transport Rule Logging">Exchange 2007/2010 Transport Rule Logging</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/resolving-anonymous-mail-gal-exchange-server-2010">Resolving Anonymous Mail to the GAL with Exchange Server 2010</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/resolving-anonymous-mail-gal-exchange-server-2010/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Microsoft Certified Master Video: Exchange 2010 Header Firewall</title>
		<link>http://exchangeserverpro.com/microsoft-certified-master-video-exchange-2010-header-firewall</link>
		<comments>http://exchangeserverpro.com/microsoft-certified-master-video-exchange-2010-header-firewall#comments</comments>
		<pubDate>Thu, 13 Jan 2011 10:00:22 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[MCM]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Transport]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=2652</guid>
		<description><![CDATA[Microsoft has released this video from MCM instructor Brian Reid about the header firewall, part of the Exchange Transport architecture that is covered in the Microsoft Certified Master program in depth.]]></description>
			<content:encoded><![CDATA[<p>Microsoft has released <a href="http://blogs.technet.com/b/themasterblog/archive/2010/12/28/mcm-exchange-video-preview.aspx">this video</a> from MCM instructor Brian Reid about the header firewall, part of the Exchange Transport architecture that is covered in the Microsoft Certified Master program in depth.  Very interesting stuff and well worth you taking the time to watch it.</p>
<p><a href="http://blogs.technet.com/b/themasterblog/archive/2010/12/28/mcm-exchange-video-preview.aspx"><img class="aligncenter size-full wp-image-2653" title="headerfirewall" src="http://exchangeserverpro.com/wp-content/uploads/2011/01/headerfirewall.png" alt="" width="533" height="359" /></a></p>
<p>Link: <a href="http://blogs.technet.com/b/themasterblog/archive/2010/12/28/mcm-exchange-video-preview.aspx">Microsoft Certified Master Video: Exchange 2010 Header Firewall</a></p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/teched-video-exchange-server-2010-high-availability-deep-dive" title="TechEd Video: Exchange Server 2010 High Availability Deep Dive">TechEd Video: Exchange Server 2010 High Availability Deep Dive</a></li><li><a href="http://exchangeserverpro.com/teched-video-exchange-server-2010-high-availability-concepts" title="TechEd Video: Exchange Server 2010 High Availability Concepts">TechEd Video: Exchange Server 2010 High Availability Concepts</a></li><li><a href="http://exchangeserverpro.com/exchange-2007-2010-infinite-loops-internal-relay-domains" title="Avoiding Infinite Loops with Internal Relay Domains in Exchange 2007/2010">Avoiding Infinite Loops with Internal Relay Domains in Exchange 2007/2010</a></li><li><a href="http://exchangeserverpro.com/exchange-server-2010-training" title="Exchange Server 2010 Training">Exchange Server 2010 Training</a></li><li><a href="http://exchangeserverpro.com/free-exchange-server-technical-education-videos" title="Free Exchange Server Technical Education Videos">Free Exchange Server Technical Education Videos</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/microsoft-certified-master-video-exchange-2010-header-firewall">Microsoft Certified Master Video: Exchange 2010 Header Firewall</a> is © 2011 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/microsoft-certified-master-video-exchange-2010-header-firewall/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check Your Legacy Exchange Servers for SMTP Usage Before Removing Them</title>
		<link>http://exchangeserverpro.com/check-your-legacy-exchange-servers-for-smtp-usage-before-removing-them</link>
		<comments>http://exchangeserverpro.com/check-your-legacy-exchange-servers-for-smtp-usage-before-removing-them#comments</comments>
		<pubDate>Thu, 15 Apr 2010 19:00:04 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Auditing]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[Logparser]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=1281</guid>
		<description><![CDATA[How to use SMTP logging and Logparser to discover IP addresses that are sending SMTP traffic through an Exchange server.]]></description>
			<content:encoded><![CDATA[<p>As you get ready to decommission legacy Exchange servers after the transition to Exchange Server 2007 or 2010 you might be concerned about any remaining devices or hosts that are using the server for SMTP traffic.</p>
<p>It has been my experience that no matter how well managed or documented an environment is, there is always some application or device that nobody thinks of that is relaying email through the Exchange server.  Whether its a custom app that some developer is running on his workstation, or a printer that does scan-to-email, something is bound to break when you remove the Exchange server.</p>
<p>Fortunately you can just about eliminate this risk with a little log monitoring on the Exchange 2003 server.  This is best performed after you have migrated all data and known services away from the server, to minimise the amount of potential traffic you pick up in the monitoring.</p>
<p>The first step is to enable logging of SMTP traffic on the server.  Open Exchange System Manager and navigate to the SMTP Virtual Server.</p>
<p><img class="aligncenter size-full wp-image-1282" title="ex2003logging001" src="http://exchangeserverpro.com/wp-content/uploads/2010/04/ex2003logging001.png" alt="" width="477" height="261" /></p>
<p>Open the properties of the SMTP Virtual Server.  Tick the box to enable logging.</p>
<p><img class="aligncenter size-full wp-image-1283" title="ex2003logging002" src="http://exchangeserverpro.com/wp-content/uploads/2010/04/ex2003logging002.png" alt="" width="405" height="449" /></p>
<p>Leave the log format as &#8220;W3C Extended&#8221; and click the Properties button.  Take note of the log file directory, and I also always enable local time for log naming and rollover</p>
<p><img class="aligncenter size-full wp-image-1284" title="ex2003logging003" src="http://exchangeserverpro.com/wp-content/uploads/2010/04/ex2003logging003.png" alt="" width="403" height="384" /></p>
<p>Click on the Advanced tab and enable at a minimum the Client IP Address.  I also include the Date and Time, and depending on your environment there may be other extended properties that you should enable.</p>
<p><img class="aligncenter size-full wp-image-1285" title="ex2003logging004" src="http://exchangeserverpro.com/wp-content/uploads/2010/04/ex2003logging004.png" alt="" width="402" height="381" /></p>
<p>Click OK, OK, etc to apply the new configuration.  You can now wait for as long as you deem necessary to capture any remaining SMTP traffic that is traversing the server.  I aim for 48 hours but in some environments a longer period would be appropriate.</p>
<p>Once the logging has been enabled and allowed to run for a while you&#8217;ll have one or more log files in the log file directory.</p>
<p><img class="aligncenter size-medium wp-image-1286" title="ex2003logging005" src="http://exchangeserverpro.com/wp-content/uploads/2010/04/ex2003logging005-450x143.png" alt="" width="450" height="143" /></p>
<p>If you look in a log file you&#8217;ll see a list of IP addresses that have connected to the server for SMTP.  A typical SMTP session will generate more than one line of logging, so this means potentially hundreds or thousands of lines of logging, maybe over multiple log files, that need to be consolidated down into a list of unique IP addresses.</p>
<p><img class="aligncenter size-full wp-image-1287" title="ex2003logging006" src="http://exchangeserverpro.com/wp-content/uploads/2010/04/ex2003logging006.png" alt="" width="452" height="325" /></p>
<p>This consolidation is made easy thanks to <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en">Logparser</a>.  Download and install Logparser, and then launch it from the Start Menu.</p>
<p>A very simple query to extract the unique IP addresses from the SMTP log files looks like this:</p>
<pre>C:\Program Files\Log Parser 2.2&gt;LogParser -i:IISW3C "SELECT DISTINCT c-ip FROM 'C:\WINDOWS\system32\LogFiles\SMTPSVC1\*.*'"
------------
192.168.0.2
192.168.0.101
192.168.0.110

Statistics:
-----------
Elements processed: 8181
Elements output:    3
Execution time:     0.09 seconds</pre>
<p>You have now got a nice short list of IP addresses that are using the server for SMTP communications and can go and investigate the applications or device configs that are causing it, before you shut down the legacy servers for good.</p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/exchange-2010-mailbox-audit-logging" title="Exchange Server 2010 SP1 Mailbox Audit Logging Step by Step Guide">Exchange Server 2010 SP1 Mailbox Audit Logging Step by Step Guide</a></li><li><a href="http://exchangeserverpro.com/powershell-send-html-email" title="How to Send SMTP Email Using PowerShell (Part 3)">How to Send SMTP Email Using PowerShell (Part 3)</a></li><li><a href="http://exchangeserverpro.com/powershell-email-message-body" title="How to Send SMTP Email Using PowerShell (Part 2)">How to Send SMTP Email Using PowerShell (Part 2)</a></li><li><a href="http://exchangeserverpro.com/powershell-how-to-send-email" title="How to Send SMTP Email Using PowerShell (Part 1)">How to Send SMTP Email Using PowerShell (Part 1)</a></li><li><a href="http://exchangeserverpro.com/how-to-read-email-message-headers" title="Email Fundamentals: How to Read Email Message Headers">Email Fundamentals: How to Read Email Message Headers</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/check-your-legacy-exchange-servers-for-smtp-usage-before-removing-them">Check Your Legacy Exchange Servers for SMTP Usage Before Removing Them</a> is © 2010 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/check-your-legacy-exchange-servers-for-smtp-usage-before-removing-them/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Configuring the Exchange Server 2007 Hub Transport Server</title>
		<link>http://exchangeserverpro.com/configuring-the-exchange-server-2007-hub-transport-server</link>
		<comments>http://exchangeserverpro.com/configuring-the-exchange-server-2007-hub-transport-server#comments</comments>
		<pubDate>Tue, 25 Aug 2009 18:33:42 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange Server 2007 Transition Guide]]></category>
		<category><![CDATA[Hub Transport]]></category>
		<category><![CDATA[ISA Server]]></category>
		<category><![CDATA[Receive Connector]]></category>
		<category><![CDATA[Send Connector]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://exchangeserverpro.com/?p=791</guid>
		<description><![CDATA[How to configure the Hub Transport Server connectors to send and receive internet email.]]></description>
			<content:encoded><![CDATA[<p>When you install Exchange Server 2007 into an existing Exchange Organization it will import many of the relevant settings for the Hub Transport server.  To begin sending and receiving email with Exchange Server 2007 we must configure Connectors.</p>
<h2>Configure the Receive Connector</h2>
<p>To allow the Exchange server to accept incoming email from the internet the default Receive Connector must be modified.  Navigate to <strong>Server Configuration/Hub Transport</strong>.  Open the properties of the default Receive Connector.</p>
<p><img class="alignnone size-full wp-image-793" title="ht01" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/ht01.png" alt="ht01" width="532" height="277" /></p>
<p>Select the <strong>Permission Groups</strong> tab and enable the <strong>Anonymous Users</strong> group.  Click <strong>OK</strong> when complete.</p>
<p><img class="alignnone size-full wp-image-794" title="ht02" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/ht02.png" alt="ht02" width="443" height="205" /></p>
<h2>Configure the Send Connector</h2>
<p>Navigate to <strong>Organization Configuration/Hub Transport</strong>.  In the Actions pane to the right of the Exchange Management Console click <strong>New Send Connector</strong>.</p>
<p><img class="alignnone size-full wp-image-795" title="ht03" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/ht03.png" alt="ht03" width="226" height="98" /></p>
<p>Enter a meaningful name such as <strong>Internet Email</strong> and set the intended use to <strong>Internet</strong>.</p>
<p><img class="alignnone size-full wp-image-796" title="ht04" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/ht04.png" alt="ht04" width="456" height="131" /></p>
<p>Click <strong>Next</strong> to continue.</p>
<p>Click the <strong>Add</strong> button and add an SMTP address space of * to route all mail to external domains over this Send Connector.</p>
<p><img class="alignnone size-full wp-image-797" title="ht05" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/ht05.png" alt="ht05" width="487" height="342" /></p>
<p>Click <strong>OK</strong> and then <strong>Next</strong> to continue.</p>
<p>If you route your outgoing mail via an ISP smart host or email security service choose that option and enter the IP address or DNS name of the smart host.  You can add more than one smart host if necessary.  Otherwise leave it configured to use DNS to route mail directly to the destination.</p>
<p><img class="alignnone size-full wp-image-798" title="ht06" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/ht06.png" alt="ht06" width="451" height="163" /></p>
<p>Click <strong>Next</strong> to continue.  The Hub Transport server is automatically included as a source server for the Send Connector.  Click <strong>Next</strong> to continue, then <strong>New</strong> to create the Send Connector with the chosen settings.  When the Send Connector has been created successfully click <strong>Finish</strong>.</p>
<h2>Allow the Exchange Server 2007 server to send email to the internet</h2>
<p>Add a rule on your network&#8217;s firewall to permit the Exchange Server 2007 server to send traffic to the internet on TCP port 25.  On an ISA Server 2006 firewall the process is as follows.</p>
<p>Open the <strong>ISA Server Management</strong> console and navigate to <strong>&lt;ISA server name&gt;/Firewall Policy</strong>.</p>
<p><img class="alignnone size-full wp-image-799" title="isa01" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa01.png" alt="isa01" width="211" height="103" /></p>
<p>Click on <strong>Create Access Rule</strong> in the Tasks pane on the right side of the ISA Server Management Console.</p>
<p><img class="alignnone size-full wp-image-800" title="isa02" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa02.png" alt="isa02" width="203" height="182" /></p>
<p>Give the new Access Rule a meaningful name such as &#8220;Permit Outbound SMTP&#8221;.  Click <strong>Next</strong> to continue.</p>
<p><img class="alignnone size-full wp-image-801" title="isa03" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa03.png" alt="isa03" width="290" height="104" /></p>
<p>Set the <strong>Rule Action</strong> to <strong>Allow</strong>.  Click <strong>Next</strong> to continue.</p>
<p><img class="alignnone size-full wp-image-802" title="isa04" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa04.png" alt="isa04" width="276" height="148" /></p>
<p>Leave the <strong>Protocols</strong> set to &#8220;Selected protocols&#8221;.  Click the <strong>Add</strong> button and choose <strong>SMTP</strong> from the <strong>Common Protocols</strong> list.  Click <strong>Add</strong> again to add SMTP to the list of permitted protocols for this Access Rule.</p>
<p><img class="alignnone size-full wp-image-803" title="isa05" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa05.png" alt="isa05" width="503" height="423" /></p>
<p>Click <strong>Close</strong> to close the <strong>Add Protocols</strong> selection dialog, then click <strong>Next</strong> to continue.</p>
<p>For the <strong>Access Rule Sources</strong> click the <strong>Add</strong> button and then click <strong>New</strong> -&gt; <strong>Computer.</strong></p>
<p><strong><img class="alignnone size-full wp-image-804" title="isa06" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa06.png" alt="isa06" width="500" height="259" /><br />
</strong></p>
<p>Enter the name and IP address of the Exchange Server 2007 server then click <strong>OK</strong>.</p>
<p><img class="alignnone size-full wp-image-805" title="isa07" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa07.png" alt="isa07" width="384" height="148" /></p>
<p>In the <strong>Add Network Entities</strong> dialog navigate to <strong>Computers</strong> and select the computer object you just created.  Click <strong>Add</strong> to add it to the new Access Rule, then click <strong>Close</strong>.</p>
<p><img class="alignnone size-full wp-image-806" title="isa08" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa08.png" alt="isa08" width="272" height="155" /></p>
<p>Now that the Exchange server is showing in the list of Access Rule Sources click <strong>Next</strong> to continue.</p>
<p><img class="alignnone size-full wp-image-807" title="isa09" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa09.png" alt="isa09" width="502" height="183" /></p>
<p>In the <strong>Access Rule Destinations</strong> dialog click <strong>Add, </strong>navigate to <strong>Networks</strong> select <strong>External</strong><strong> </strong>then click <strong>Add</strong> and <strong>Close</strong>.  Click <strong>Next</strong> to continue.</p>
<p><img class="alignnone size-full wp-image-808" title="isa10" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa10.png" alt="isa10" width="500" height="239" /></p>
<p>Leave the <strong>User Sets</strong> configured to <strong>All Users</strong>.  Click <strong>Next</strong> to continue, then click <strong>Finish</strong> to close the New Access Rule Wizard.</p>
<p>Apply the ISA rule changes.</p>
<p><img class="alignnone size-full wp-image-809" title="isa11" src="http://exchangeserverpro.com/wp-content/uploads/2009/08/isa11.png" alt="isa11" width="500" height="103" /></p>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/publish-incoming-smtp-to-the-exchange-server-2007-server-with-isa-server-2006" title="Publish incoming SMTP to the Exchange Server 2007 server with ISA Server 2006">Publish incoming SMTP to the Exchange Server 2007 server with ISA Server 2006</a></li><li><a href="http://exchangeserverpro.com/how-to-share-an-email-domain-between-two-mail-systems" title="How to Share an Email Domain Between Two Mail Systems">How to Share an Email Domain Between Two Mail Systems</a></li><li><a href="http://exchangeserverpro.com/route-outbound-email-through-the-exchange-server-2007-hub-transport-server" title="Route outbound email through the Exchange Server 2007 Hub Transport server">Route outbound email through the Exchange Server 2007 Hub Transport server</a></li><li><a href="http://exchangeserverpro.com/publish-exchange-server-2007-owa-using-isa-server-2006" title="Publish Exchange Server 2007 OWA Using ISA Server 2006">Publish Exchange Server 2007 OWA Using ISA Server 2006</a></li><li><a href="http://exchangeserverpro.com/exchange-2007-2010-infinite-loops-internal-relay-domains" title="Avoiding Infinite Loops with Internal Relay Domains in Exchange 2007/2010">Avoiding Infinite Loops with Internal Relay Domains in Exchange 2007/2010</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/configuring-the-exchange-server-2007-hub-transport-server">Configuring the Exchange Server 2007 Hub Transport Server</a> is © 2009 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/configuring-the-exchange-server-2007-hub-transport-server/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Install telnet on Windows Server 2008</title>
		<link>http://exchangeserverpro.com/install-telnet-on-windows-server-2008</link>
		<comments>http://exchangeserverpro.com/install-telnet-on-windows-server-2008#comments</comments>
		<pubDate>Fri, 25 Jul 2008 23:31:55 +0000</pubDate>
		<dc:creator>Paul Cunningham</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ServerManagerCMD]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[Telnet]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://www.capslockassassin.com/2008/07/26/install-telnet-on-windows-server-2008/</guid>
		<description><![CDATA[If you&#8217;re needing to do some SMTP testing using a Windows Server 2008 host you&#8217;re probably going to need a Telnet client.&#160; The Telnet client is not installed by default on Windows Server 2008, so you can use this ServerManagerCmd.exe one-liner to quickly install it: C:\&#62;servermanagercmd -i telnet-client ......... Start Installation... [Installation] Succeeded: [Telnet Client]. [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re needing to do some SMTP testing using a Windows Server 2008 host you&#8217;re probably going to need a Telnet client.&nbsp; The Telnet client is not installed by default on Windows Server 2008, so you can use this <a title="ServerManagerCmd.exe Command Line Reference" href="http://www.exchangeserverpro.com/2008/06/05/windows-server-2008-servermanagercmdexe-command-reference/" target="_blank">ServerManagerCmd.exe</a> one-liner to quickly install it:</p>
<pre>C:\&gt;servermanagercmd -i telnet-client
.........

Start Installation...
[Installation] Succeeded: [Telnet Client].
&lt;100/100&gt;

Success: Installation succeeded.</pre>
<h3  class="related_post_title">Related posts:</h3><ul class="related_post"><li><a href="http://exchangeserverpro.com/how-to-send-email-via-telnet" title="Email Fundamentals: How to Send Email via Telnet">Email Fundamentals: How to Send Email via Telnet</a></li><li><a href="http://exchangeserverpro.com/windows-server-2008-servermanagercmdexe-command-reference" title="Windows Server 2008 ServerManagerCMD.exe command reference">Windows Server 2008 ServerManagerCMD.exe command reference</a></li><li><a href="http://exchangeserverpro.com/powershell-send-html-email" title="How to Send SMTP Email Using PowerShell (Part 3)">How to Send SMTP Email Using PowerShell (Part 3)</a></li><li><a href="http://exchangeserverpro.com/powershell-email-message-body" title="How to Send SMTP Email Using PowerShell (Part 2)">How to Send SMTP Email Using PowerShell (Part 2)</a></li><li><a href="http://exchangeserverpro.com/powershell-how-to-send-email" title="How to Send SMTP Email Using PowerShell (Part 1)">How to Send SMTP Email Using PowerShell (Part 1)</a></li></ul><hr />
<p>This article <a href="http://exchangeserverpro.com/install-telnet-on-windows-server-2008">Install telnet on Windows Server 2008</a> is © 2008 ExchangeServerPro.com</p>
<p>Get more <a href="http://exchangeserverpro.com">Exchange Server tips</a> at <a href="http://exchangeserverpro.com">ExchangeServerPro.com</a></p>]]></content:encoded>
			<wfw:commentRss>http://exchangeserverpro.com/install-telnet-on-windows-server-2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

