The following configuration is used in Web. config
<system.net>
<mailSettings>
<SMTP from= "[email protected]" >
<network host= "localhost" port= "/>"
</smtp>
</mailSettings>
</system.net>
Send mail directly using localhost.
The deployment encountered an exception on the server: Mailbox unavailable. The server response was:5.7.1 unable to relay for [email protected]
You need to configure the SMTP server for IIS6 Manager
1. Open IIS6 Manager using Control Panel = Administrative Tools.
2. Open SMTP Virtual Server properties.
3. On General tab, Set IP address of the WEB server instead of ' all Unassigned '.
4. In the Access tab, click on the Relay button, this would open Relay restrictions dialog.
5. In relay Computers list, add the IP addres 127.0.0.1.
Windows Server 2012/2012 R2: Installing and configuring an SMTP server
Installing the SMTP server
The following are the steps to install the SMTP Server feature:
- Open Server Manager: Click the Windows button on your keyboard. Enter Server Manager. In the Results window, click Server Manager ...
- Click Dashboard in the left pane ...
- Click Add roles and Features. You can also open add roles and features from the Manage menu in the upper-right corner.
- On the Before you begin window, click Next.
- In installation type, click Role-based or feature-based installation. Click Next.
- In server selection, click Select a server from the server pool, then the desired server and next. The Server Selection window lists the servers that were added in Server Manager using Add server. By default, the local server is selected. Adding a server to Server Manager lists the steps to use Add Server on Windows Server 2012.
- In the Server Roles window, click Next.
- In the Features window, select SMTP server. If prompted, click Add Features. Click Next.
- In confirmation, select automatically restart the destination server if required, and then click Install. When you are finished, click Close.
Configuring the SMTP Server
The following are the steps to configure an SMTP virtual server by using IIS 6.0 Manager:
- Open IIS Manager: Click the Windows button on the keyboard. Enter "IIS". In the Results window, click Internet Information Services (IIS) 6.0 Manager.
- Expand the computer name. Right-click [SMTP Virtual Server 1], and then click Properties.
- On the Access tab, click the Relay button.
- Click Add. For single computer, enter 127.0.0.1, and then click OK.
By adding 127.0.0.1, we will allow the local server to send messages from this SMTP server. If you want other computers to send messages from this SMTP server, enter their IP address.
- In the Delivery tab, click Outbound Security. Select the following options:
Anonymous access: No account name or password is required. This option disables SMTP server authentication.
Basic authentication: Sends the account name and password of the server to which you want to connect in clear text. The account you enter is used to transfer e-mail. When you send an e-mail message to a personal account or an Exchange account, you can select Basic authentication. Because credentials are passed in clear text, it is recommended that you enable TLS encryption.
Integrated Windows authentication: The Windows domain account name and password are used for authentication. The account you enter is used to transfer e-mail.
TLS encryption: Similar to SSL, TLS is used to secure the connection. A valid SSL server certificate needs to be installed on this server.
-
Tip Tips
-
To test the core SMTP feature with your personal e-mail account, including your Exchange account, select Anonymous access. When you select Basic Authentication, SMTP uses the AUTH command. Some email providers may fail because of the AUTH command. If the AUTH command fails, the error may be logged to the Windows event log on the SMTP server.
- In the Delivery tab, click Outbound Connections. By default, the TCP port is 25. If another port is already open inside the firewall, you can enter a different port. Click OK.
- In the Delivery tab, click Advanced. By default, the "Fully qualified domain name" of the local server is listed. The smart host property can be left blank, depending on the Internet provider. You may need to contact your Internet provider to verify that you need a smart host. Otherwise you may not be able to enter SMTP. Emailprovider.com.
-
Note Note
-
A smart host (also known as a relay host) is an Exchange server that is dedicated to routing all outgoing messages. After the smart host receives the message, it forwards the message to the remote domain. The goal of the smart host is to improve the performance of your Exchange Server. Instead of repeatedly contacting the remote domain until the connection is established, Exchange Server transmits only to the smart host.
- Click OK to close all windows.
- Restart the SMTP server: Right-click [SMTP Virtual Server 1], and then click Stop and Start. You must restart to apply the SMTP server settings.
But not solve my problem, have been able to see the C:\inetpub\mailroot\Queue in the. eml file, but still can't send out, do not know why.
SMTP server Settings