How to configure SMTP for outbound emails


UCF uses a third-party SMTP relay service for sending both transactional and marketing emails.

Transactional email is an email that is sent to an individual or small recipient groups. Examples of transactional email include: NID password resets, enterprise remote & heartbeat monitoring, notification emails, feedback, service-now tickets, ePAF forms, LEAP requests etc.  

 
Marketing email is an email that is sent to multiple recipients. Examples of marketing emails include: email newsletters, promotional email campaigns, student grades, outage communication etc. 


Instructions for using this are provided below.

Table of Contents

 

SMTP Relay

UCF's SMTP relay service can be accessed using authenticated account credentials for either Transactional (1:1) or Marketing (1:MANY) outgoing email.

SMTP Relay Prerequisites

Before you can start using the SMTP Relay, you need to do the following:

 

  1. Submit a Service-Now request to request credentials.
    • Sending email from the FROM address of @ucf.edu address is supported. To send email from another mail sub-domain, (example, bus.ucf.edu, ist.ucf.edu) additional CNAME records may need to be added to DNS. Mail domains may only be added if owned by UCF.
  2. Obtain an USERNAME and API Key
  3. Make sure your application supports authentication.

How to send an email using UCF's Authenticated SMTP Relay

To configure your application to send email through UCF's SMTP service, use the settings below.

 

Here’s an example of configuring WordPress to use SendGrid:


 

 

SMTP API

Alternatively UCF's SMTP relay server supports the use of API Keys. API Keys allow you to use another method of authentication separate from your account username and password. To use keys, you must set a plain text header named “Authorization” with the contents of the header being “Bearer XXX” where XXX is your API Secret Key.

SMTP API Prerequisites

Before you can start using the API, you need to do the following:

  1. Submit a Service-Now request to request credentials.
  2. Obtain an USERNAME and API Key
  3. Make sure you have curl installed on your machine.


Your API call must have the following components:

Example Header

GET https://api.sendgrid.com/v3/resource HTTP/1.1
Authorization: Bearer Your.API.Key-HERE

curl -X "GET" "https://api.sendgrid.com/v3/templates" -H "Authorization: Bearer Your.API.Key-HERE" -H "Content-Type: application/json"

 

Libraries

 

How To Send an email using UCF's SMTP API

------------------------------
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header 'Authorization: Bearer <<YOUR_API_KEY>>' \
--header 'Content-Type: application/json' \
--data '{"personalizations":[{"to":[{"email":"john.doe@example.com","name":"John Doe"}],"subject":"Hello, World!"}],"content": [{"type": "text/plain", "value": "Heya!"}],"from":{"email":"sam.smith@example.com","name":"Sam Smith"},"reply_to":{"email":"sam.smith@example.com","name":"Sam Smith"}}'\

-----------------------------

  1. Copy the curl example above.
  2. Paste the curl call into your favorite text editor.
  3. Copy your API key and paste it in the "Authorization" header.
  4. In the data section, specify the "to", "from", and "reply to" names and email addresses and enter a subject.
  5. Copy the code and paste it in your terminal.
  6. Hit Enter.
  7. Check the inbox of the address you specified as the "to" email and see your message!

 

API Response Messages

All responses are returned in JSON format. We specify this by sending the Content-Type header. The Web API v3 provides a selection of response codes, content-type headers, and pagination options to help you interpret the responses to your API requests.

 

Testing

You may need to install Telnet on your machine. Telnet comes natively on some operating systems; However, recent releases of MacOS no longer include Telnet, and Telnet must be enabled manually on Windows 10 and Windows 11.

To enable Telnet on Windows 10, navigate to Windows Features > Turn Windows Features on or off from the Windows Control Panel. Check the box next to Telnet Client, and select OK.

 

Testing Prerequisites

Before you can start using the SMTP Relay, you need to do the following:

  1. Submit a Service-Now request to request credentials.
  2. Obtain an USERNAME and API Key
  3. Make sure your application supports Telnet.

 

How to send a Test using Telnet

  1. Start a Telnet session by typing the following in the terminal:
TELNET smtp.sendgrid.net 25

SendGrid accepts unencrypted and TLS connections on ports 25, 587, & 2525. You can also connect via SSL on port 465. Many hosting providers and ISPs block port 25 as a default practice. If your Telent session continually times out or will not connect using port 25, it is likely that your ISP or hosting provider is blocking the port. You can contact your host/ISP to find out which ports are open for outgoing SMTP relay. We recommend using port 587 to avoid any rate limiting that your server host may apply.

  1. Once you successfully connect to SendGrid, log in to the server by typing the following:
AUTH LOGIN

The mail server will respond with 334 VXNlcm5hbWU6, which is a Base64 encoded request for your username.

  1. Input YXBpa2V5 and press Enter on your keyboard. Twilio SendGrid requires you to authenticate using an API key. When using Basic Authentication and an API key, you must use the string apikey in place of your account username. The string apikey is YXBpa2V5 when Base64 encoded, which is why we use it in this step.

The mail server will respond with 334 UGFzc3dvcmQ6. This response is a Base64 encoded request for your password (your API Key).

  1. Enter your Base64 converted API key in the next line as the password and press Enter.

The mail server will respond with 235 Authentication successful. Getting this far indicates that your connection to smtp.sendgrid.net over the chosen port is open and that your API key is valid.

  1. Next, add the email that you’re sending from using the SMTP MAIL FROM command and press Enter.
MAIL FROM: <SENDER_EMAIL>

The mail server will respond with 250 Sender address accepted.

  1. Add the email that you’re sending to using the SMTP RCPT TO command and press Enter.
RCPT TO: <RECIPIENT_ADDRESS>

Note that you can add more RCPT TO addresses during this step. Repeat the process by adding another RCPT TO command and pressing Enter for each recipient you intend to deliver the message to.

The mail server will respond with 250 Recipient address accepted after each recipient is added.

  1. On the next line, type DATA and press Enter.

The mail server will respond with 354 Continue. Unlike the MAIL FROM and RCPT TO commands, which are part of the email envelope, the DATA command is not meant to contain information that routes your email from a sender to a recipient. Instead, DATA allows you to modify the content of your message.

  1. Optionally, add a mail-to header to add the name and email address of the recipient to the email header and press Enter. Note that the name should be wrapped in quotation marks, and the address should be wrapped in a greater than and less than symbol.
To: "<RecipientName>" <<RecipientEmailAddress>>
  1. Next, add a from header to add the name and email address of the sender to the email header and press Enter. If a from header is not included, SendGrid will block your email because it doesn’t follow RFC 5322 compliance guidelines. Note that the name should be wrapped in quotation marks, and the address should be wrapped in a greater than and less than symbol.
From: "<SenderName>" <<SenderEmail>>
  1. Include a subject line and press Enter.
Subject: <EMAIL_SUBJECT>
  1. Press Enter again to add a carriage line return. Then add the body content of the message and press Enter.
"<MESSAGE>"

For example:

“This is a test for the SMTP relay."
  1. Finally, send the email by typing a period, ., and then pressing Enter.

The mail server will return 250 Ok: queued as <examplestring1234>. This means the email has been queued to send. The queue moves very quickly, and you should see mail delivered to the designated recipients shortly.

  1. Exit the Telnet connection by typing quit and pressing Enter.

The full command should look like the following example.

235 Authentication successful
MAIL FROM:tiramisu@example.com
250 Sender address accepted
RCPT TO:person1@sendgrid.com
250 Recipient address accepted
DATA
354 Continue
From: "Tira Misu" <tiramisu@example.com>
To: "Person 1" <person1@sendgrid.com>
Subject: Test message subject

"This is the test message body."
.
250 Ok: queued as Yo60h6C5ScGPeP5fUWU3K


Unauthenticated Email Users

The University provides a legacy method to relay outgoing email. This service (ucfsmtp.mail.ucf.edu) is used in the case where a server, device or application needs to send email but is unable to authenticate. 

 

This service is used by:

 


Use these parameters:

 

Server name: ucfsmtp.mail.ucf.edu
Port: 25
Connection security: none
Authentication method: No authentication required

Server name: ucfsmtp1.mail.ucf.edu
Port: 465 for SSL-encrypted email
Connection security: none
Authentication method: No authentication required