A simple mail transfer protocol (SMTP) relay is a computer that is connected to the Internet and is running software that allows it to act as an SMTP server with the intention of directing incoming and outgoing electronic mail (email) to a specific destination online. An SMTP relay server is capable of accepting emails from a remote source and either delivering the emails internally, if the destination is the server itself, or forwarding those emails to other SMTP servers as needed. Additionally, such a relay can be configured in different ways to help prevent malicious emails or junk emails from being processed. There are two primary types of SMTP relay servers, with the first being an open relay by which any computer anywhere in the world can connect and send mail through the server. The second type is an authenticated relay, through which any system that connects to the SMTP relay must provide at least one valid username and password combination, though multiple usernames and passwords also might be required for each operation.
When an email message is composed and sent by a user, the message generally is passed through an SMTP server to reach the recipient. If one SMTP server contacts another SMTP server and transfers an email to it, then the SMTP server that receives the email is known as an SMTP relay, because it is relaying the email. The relay does not have to be the target server and can act as a gateway or intermediary step between the source server and the destination server. Should the relay be the target server, the email messages that are received can be passed to local software so they can be retrieved by client programs as needed.
Many SMTP relay servers use authentication to sort out what incoming mail traffic should be processed and what messages should be rejected and left for other servers to process. Frequently, an SMTP relay will only serve incoming or outgoing messages that have some relation to the Internet domain to which it is connected. This prevents anonymous or random users from using the server to send emails that could be harmful or unwelcomed. If no authentication is required, then the SMTP relay simply will process all incoming messages as best it can.
In some situations, an SMTP relay server can be hosted on a dedicated machine. This has the benefit of isolating the server from the rest of a larger network. It also allows one relay to act as a front-end filter, removing harmful emails or stripping messages of their attachments before passing them to other SMTP relays for actual processing.