This repository has been archived by the owner on Feb 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
SMTP Server Setup with SendGrid
Harun Davood edited this page Oct 13, 2017
·
1 revision
- Windows Server with IIS > 7.0 enabled
- A SendGrid account with a username and password
- Open IIS Manager in Windows
- Click on your site and double-click on the “SMTP E-mail” under the ASP.NET section
- Click on the “Deliver e-mail to SMTP server” radio button if not already enabled and enter 'localhost' In the SMTP Server field or check the 'Use localhost' box
- In the port field, type 587.
- In Authentication Settings click the “Not required” option.
- On the right side “Actions” pane: click Apply
- Access the "Windows Features On and Off" feature on your Windows server.
- Click "Next" until you get to the Features tab.
- Scroll down the list to the SMTP Server, and check the box. The Required Role Services dialog will appear, listing all of the dependencies that the SMTP server depends on to operate. Click Add Require Role Services.
- Click Next twice and review the list of available IIS Role Services and check any that you would like to add
- Click Next then click Install
- Once the SMTP Server service is installed, the IIS 6.0 virtual server technology is activated, and the IIS 6.0 administration snap-in will now be active.
- From the Server Manager interface Go to Tools > IIS 6.0 Manager
- Right click on the SMTP Virtual Server #1 and select the Properties option
- Click the box to enable logging section to assist you in configuring the server
- Click on Properties and check the box to activate Use Local Time For File Naming And Rollover option Click on the Advanced tab and check the following items: Date, Time, Client IP Address, User Name, Service Name, Server Name, Server IP Address, Server Port, Method, Protocol Status, Bytes Sent, Protocol Version, and Host.
- Click OK
- Click on the Access tab the click the Relay button in the Relay Restrictions section
- Click Add, enter 127.0.0.1, and click OK. The IP will appear in the list with Access Granted
- Click OK Only The List Below radio button and enter 127.0.0.1 in the IP address field.
- Click on OK to return to the Access tab as shown in the previous screenshots.
- Select the Delivery tab and click the Outbound Security button
- Click on Basic Authentication where the Username will be your SendGrid.com username and the password will be your SendGrid.com password
- Click OK
- Click the Advanced button
- In the Smart host field: enter smtp.sendgrid.net
- Click on OK twice and you can close the IIS 6.0 admin MMC
- In IIS 6.0 Manager, expand the SMTP virtual server, right-click Domains, point to New, and then click Domain.
- In Welcome to the New SMTP Domain Wizard, ensure that the Remote option is selected, and click Next.
- In Domain Name, in the Name text box, type in:
smtp.sendgrid.net
- Right-click the domain you just created, and then click Properties.
- Select the Allow incoming mail to be relayed to this domaincheck box.
- Click Outbound Security, and then configure the authentication and provide the credentials required by the SMTP server to which the smart host will connect.
- Open up a telnet client within Windows. You do that in the Command Prompt by entering the following:
telnet localhost 587
- With telnet running, enter the following commands pressing ENTER for each new line (if configured correctly, the server won’t do anything until you enter the period):
EHLO
AUTH LOGIN
<Enter your BASE64 encoded SendGrid username here>
<Enter your BASE64 encoded SendGrid password here>
- Send a message to a specific email address by entering the following commands pressing ENTER for each new line. You will complete your message after typing the message body and entering a "." on a new line.
mail from: <enter any sender address here>
rcpt to: <enter a valid email address here>
data
To: <enter recipient name here>
From: <enter sender name here>
Subject: <enter email subject here>
<hit enter>
<type message body and hit enter>
.
- If these manually entered commands work, then you should have the following success code: "250….Queued mail for delivery"
Note: If you receive an error stating “‘telnet’ is not recognized as an internal or external command, operable program or batch file.” this means that Telnet is not installed on your machine. This can be done by visiting your “Add and Remove Progams” section within your Control Panel, and installing the ‘Telnet Client’ and ‘Telnet Server’ packages within ‘Turn Windows features on or off”.