Sie sind auf Seite 1von 14

1. Type rcpt to:youremail@yourdomain.

com, and
How to Test SMTP then press ENTER.

Services Manually in The output resembles the following:

Windows Server 250 OK - Recipient <youremail@yourdomain.com>

How to Test SMTP Services 1. Type Data, and then press ENTER.

Manually in Windows Server The output resembles the following:

Summary 354 Send data. End with CRLF.CRLF

This article describes how to test the Simple Mail 1. Type Subject:This is a test, and then press
Transfer Protocol (SMTP) service for any system. ENTER two times.
2. Type Testing, and then press ENTER.
Test the SMTP Service 3. Press ENTER, type a period (.), and then press
ENTER.
To test the SMTP service, follow these steps:
The output resembles the following:
1. On a client computer running Windows Server
or Windows 10 (with telnet client installed), 250 OK
type
Telnet at a command prompt, and then press 1. Type quit, and then press ENTER.
ENTER.
2. At the telnet prompt, type set LocalEcho, press The output resembles the following:
ENTER, and then type open <machinename>
25, and then press ENTER. 221 Closing Port / Mail queued for delivery

The output resembles the following:

220 computername.microsoft.com ESMTP Server


(Microsoft Exchange Internet Mail Service
5.5.2651.58) ready

1. Type helo me, and then press ENTER.

The output resembles the following:

250 OK

1. Type mail from:email@domain.com, and then


press ENTER.

The output resembles the following:

250 OK - mail from <email@domain.com>


1. Install the Telnet client NOTE: Once the telnet session is established,
the Backspace and Delete keys do not work. If
Testing a connection to a mail server with Telnet can yield a typo is made, press Enter and retry the
valuable information when troubleshooting a mail-flow issue. command. In some cases, it may be necessary
For instance, if the connection from the local server is being
to close the telnet session and reconnect.
denied, there will typically be a human-readable error message
displayed within the Telnet session. If the error description
doesn't provide sufficient information to troubleshoot the issue, o If you receive an error similar to Could not open
there will typically be an SMTP error code provided as well. connection to the host, on port 25: Connect failed,
Researching this error code should provide a wealth of useful this indicates that your machine could not establish a
information. telnet session with the destination server using port 25.
If you initially attempted to connect using the
Before you can use the Telnet client to test connectivity, it destination server's name, try to connect using its IP
must first be installed. Below are instructions for installing the address instead. If this is successful, you likely have a
Telnet client in Windows Server 2008 and 2008 R2. DNS issue. If you are unable to connect using the
destination server's name or IP address, port 25 is
1. Launch Server Manager. being blocked somewhere between your machine and
2. In the left pane, click Features. the destination server. The issue is probably due to a
3. In the right pane, click Add Features. firewall on the destination server's end, but it can also
4. Check the box labeled Telnet Client and click Next. be caused by a network misconfiguration or firewall
Note: Do not check the Telnet Server box. This on your end.
feature is used to allow other machines to connect to o If you receive output similar to the following:
this server using Telnet. 554-remote.mailserveraddress.com
554 Your connection has been blocked due to low
sender reputation...
5. Click Install. Connection to host lost.
6. Once the installation is complete, click Close. It The public IP address associated with your mail server
should not be necessary to reboot the server. has developed a bad reputation. If you recently
acquired this IP address, its previous owner likely sent
spam from it, and your best option may be to request a
For Windows Server 2012 instructions, refer to
different address from your ISP. If this is not feasible,
the following Dell article and choose the Telnet
there are other options, but there is not always a quick
Client feature: How to Install a Role or Feature in
or easy solution to this issue. The error message may
Windows Server 2012.
include additional instructions for resolving the issue.
If not, this blog entry has a number of suggestions.
Note: While it is recommended to perform this test from a mail Unfortunately, it may simply be a matter of waiting for
server (in other words, install the Telnet client on your local your address's reputation to improve, and this can take
considerable time.
mail server and use it to connect to a remote one) in order to
3. Type: EHLO <mail server internet name>
closely simulate real-world email delivery, it is also possible to Replace <mail server internet name> with your mail
install the Telnet client on a Windows client OS, such as server's public fully qualified domain name - for
Windows 7, by using the Programs and Features Control Panel instance, mail.dell.com.
applet. 4. Type: mail
from: <your_name@yourdomain.com> and press
2. Test the connection and send an email Enter.
5. Type: rcpt to: <recipient@recipientdomain.com> and
Once the Telnet client has been installed, follow the steps press Enter.
below to test email delivery. 6. Type: data and press Enter.
7. Type: Subject: <a subject here> and press Enter.
1. Open a command prompt. 8. Type: This is a test message sent from telnet. and press
2. Type the following command: telnet <mail server Enter.
name or IP> 25 9. Type: . and press Enter
o You should receive output similar to the The message should be accepted for delivery.
following:
220 remote.mailserveraddress.com ESMTP
Setup and Configure configure Microsoft Exchange Server for
that purpose. If you are looking a free mail
server then I recommend hMailServer.
SMTP Server on
Windows Server 2008 Installing the SMTP
R2 feature
April 26, 2012 by japinator
1. Click Start > Run and then
enter servermanager.msc in
There has been some confusion about how the Open dialogue box then click OK to
to setup and configure an SMTP load Server Manager:
Server or mail relay on Windows Server
2008 R2. The confusion has arisen due to
C:\Users\Admin>servermanager.msc
the SMTP server component not being
managed from with IIS 7.5 but is instead 2. Use the Add Features Wizard to
managed from the IIS 6 console. In order to select SMTP Server on the Select
have SMTP working you must install IIS 6 as Features page. To initiate this, right-click
a feature. The following steps will explain on Features and click Add Feature:
how to setup and configure SMTP from start
to finish.

Note: The steps for installing an SMTP


Server or mail relay on Windows Server
2012 are very similar except for a few minor
GUI changes. See this post for the exact
steps.

I have noticed a few forum posts where


people are wrongly following the steps in
this article thinking that they are setting up a
mail server to send and receive emails for
their domain – this is incorrect. The steps
outlined in this post are to create a virtual
SMTP Server or mail relay, which sends
messages only. This is typically used when
web applications generate emails and
use the mail relay to deliver them. That is
very different from setting up a mail server. If
the latter is your desired goal and it is for a
commercial operation, then I suggest you
search online for steps to install and
3. In the Features section check SMTP
Server and click Next:

4. You may see a dialogue box like the one


below stating that certain role services and
features are required for SMTP:
5. Click Add Required Role Services and
then you will return to the
previous Features section. Ensure SMTP
Server is checked then click Next.

6. In the Web Server (IIS) section,


click Next to proceed to the Role
Services section:

7. The Role Services should be pre-


populated – IIS 6 Management
Compatibility should be selected, and
below it, IIS 6 Metabase
Compatibility and IIS 6 Management
Console should also be checked.
Click Next to continue:
8. In the Confirmation section click Install: 9. In the Results section click Close to
complete the installation of the SMTP
Server:
11. In IIS 6 Manager right-click on SMTP
Server and select Properties:

12. In the General tab, unless you want


the SMTP Server to use a specific IP
address, leave the settings as they are so
Configuring the SMTP that the IP address is set to (All
Unassigned):
Server
The next step is to configure SMTP. To do
so we will need to open Internet
Information Services (IIS) Manager 6.

10. Click Start > Run and then


enter inetmgr6 in the dialogue box then
click OK to load IIS Manager 6.
13. To proceed, click on the Access tab: 14. Click on the Authentication button and
ensure Anonymous access is checked and
then click OK:
The Connection setting controls
which computers can connect to the SMTP
server and send mail. By granting
only localhost (127.0.0.1) access, limits only
the server itself the ability to connect to the
SMTP server. This is a requirement for
security.

16. Click OK to return to the Access tab and


then click on
the Relay button. Enter 127.0.0.1 as the IP
addess and then click OK:

15. Once back in the Access tab, click on


the Connection button. Select Only the list
below and then
click Add. Enter 127.0.0.1 as the IP addess
and then click OK:

The Relay section determines which


computers can relay mail through this SMTP
server. By only allowing the localhost IP
address (127.0.0.1) relay permissions it
means that only the server itself can relay
mail. Conversely, it prevents the SMTP
server from being an open relay and being
used to send unsolicited spam email by
other computers on the internet, which could
lead to the SMTP server being blacklisted.

17. Next, go to the Messages tab. Here you


can enter an email address where copies of
non-delivery reports are sent to. You can
also configure the location of
the Badmail director, however, the default
setting should suffice:

19. Click on the Outbound Security button


and ensure Anonymous access is
selected. As the only server that can
connect and relay mail through the SMTP
server is localhost this security settings is
fine:

18. Next, go to the Delivery tab:


Here you will need to enter the fully-qualified
20. Click OK to return to the Delivery tab domain name of the SMTP server. This will
and then click on Outbound Connections. be the host name or A record that has been
Leave the defaults as they are: created in your DNS zone file. This is
straight-forward to do but you will have to
confirm how you do this with the party that
manages DNS for your domain. I have
entered mail.vsysad.com as this is fully-
qualified. If you click on the Check
DNS button you can confirm whether your
chosen name resolves successfully. In my
case it does as I see the following:

21. Click OK to return to the Delivery tab


and then click on Outbound Connections,
then click on the Advanced button:
22. Click OK and then OK again to exit The reason I am highlighting this is because
the SMTP Virtual Server Properties. if your SMTP Server sits within a corporate
network it will most likely use an internal
You can also perform this test by DNS server. Often these are only configured
running nslookup to confirm the existence to resolve internal namespaces therefore
of the host name as well as confirming the resolving external hostnames may fail. Also,
IP address it resolves to – which should be firewall rules may block your SMTP Server
the IP address of your server: from querying any DNS servers so please
check and ensure DNS queries are resolved
successfully and if not make sure it get
fixed before going onto the testing phase
below.

Another very important point about DNS is


that you must ensure that you have a PTR
record for reverse DNS lookups configured.
The PTR record allows your SMTP Server’s
public IP address to be resolved back to
your hostname. Some of the big email
service providers perform reverse DNS
lookups of mail servers connecting to them
as a security measure to check their
credibility or reputation. Your web hosting
company should have a control panel that
allows you to configure reverse DNS if you
have a dedicated public IP address. Not
having a PTR record will not guarantee
email delivery failure but it will very likely
Please note that DNS is crucial to delay email delivery and at worst may result
successful email delivery. If your SMTP in your messages being blocked and your
server cannot resolve the domains it is trying host being blacklisted. I highly recommend
to send messages to then it will fail. Ensure you you configure a PTR record for your
that the DNS servers you have configured server.
are able to resolve DNS queries
successfully. From the above screenshot
Follow the instructions in this post which
you can see that the DNS server I have
shows you how to verify correct DNS
configured, cachens2.dfw1.rackspace.co
configuration using the SMTPDIAG tool.
m, was able to successfully resolve my
SMTP server’s
hostname, mail.vsysad.com. This is one of 23. The last configuration step will be to set
Rackspace’s many DNS servers and I am the SMTP Service to Automatic so that it
100% confident it works fine. automatically starts when the server boots
up. Open up the command prompt and run
the command below to enable this setting: .
25. Save the changes to email.txt and then
C:\Users\Admin>sc config "smtpsvc" start= copy the file to C:\inetpub\mailroot\Pickup.
auto The SMTP server monitors this folder and
[SC] ChangeServiceConfig SUCCESS when it detects the email.txt file, it will read
Then run the command below to confirm the contents and send the email to the
that the service is actually running: address in the To: section. This should
happen almost immediately.
C:\Users\Admin>sc query "SMTPSVC" | find
"RUNNING"
STATE : 4 RUNNING
26. Check the email address the email was
sent to and it should arrive shortly – the
If the SMTP Service is not running the
email was sent to my Gmail account:
command above will not return a
state/result. If that is the case then run the
command below to start it:

C:\Users\Admin>net start smtpsvc


The Simple Mail Transfer Protocol (SMTP)
service is starting.
The Simple Mail Transfer Protocol (SMTP)
service was started successfully.
We are now ready to test the configuration.
An alternative way of doing this is to use a
Testing the SMTP script to perform the same email test. Simply
save the code below into a file
Server called email.vbs, remembering to change
the email address information to reflect your
The next step is to verify that the SMTP own details:
server is able to send email successfully. To
do this follow the steps below: Dim sch, cdoConfig, cdoMessage
sch
= "http://schemas.microsoft.com/cdo/configur
24. Create a text file on your desktop ation/"
called email.txt and paste the following into
Set cdoConfig =
it, remembering to change the email address CreateObject("CDO.Configuration")
information to reflect your own details: With cdoConfig.Fields
.Item(sch & "sendusing") = 1 '
From: blog@yourdomain.com cdoSendUsingPort
To: email@yourdomain.com .Item(sch & "smtpserver") = "127.0.0.1"
Subject: Email test ' .Item(sch & "smtpserverport") = 25
.update

This is the test body of the email End With


Set cdoMessage = CreateObject("CDO.Message") as info@yourdomain.com that monitor this
With cdoMessage information. See this post to learn how to do
Set .Configuration = cdoConfig
this using an ASP.NET 4.0 C# email web
.From = "blog@yourdomain.com"
form application.
.To = "email@yourdomain.com"
.Subject = "Email test" That’s all there is to it! Now you have a fully
.TextBody = "This is the test body of the functioning STMP server that can
email" successfully send emails. Many of the
'.AddAttachment "c:\images\myimage.jpg" companies that I have worked with use this
.Send method to send emails generated by
End With their web applications.
Set cdoMessage = Nothing
Set cdoConfig = Nothing If emails are not being successfully
MsgBox "Email Sent" delivered you may notice that messages are
Once the file has been saved to the desktop building up in specific SMTP folders. Visit
double-click on it and it should automatically this post to understand the purpose of each
send the the email. A message box pops up SMTP folder and how to approach issues
to confirm that the email was sent: when messages are queuing up in those
folders.

Apparently there’s more than one way to


skin a cat, there’s also more ways to test
your mail relay server:

You can also use telnet and PowerShell to


test mail sending/routing via SMTP Server.
Please refer to this post to see how to do
this.

You can also use an email web form


application which is similar to a contact
us page on a website which allows you to
post some feedback, which then uses an
SMTP Server to deliver the messages to
specific email contacts such

Das könnte Ihnen auch gefallen