What exactly is an SMTP relay, and what exactly is an SMTP smarthost? Can someone give me a brief description of each, including how they relate to one another?
In general, both are mail relays, and a mail relay is just a server that passes mail to another mail server, via SMTP, rather than a server that offers mailbox service to end users via POP3/IMAP/HTTP.
A smarthost is a mail relay that is specialized to deal with outbound email. If you have a private LAN, you may want to control the flow of outbound email, and prevent "any old server" from being able to deliver email to the internet, or perhaps your internal systems only resolve internal DNS and can't resolve hosts or domain MX records for systems "out there on the interwebs". In a case like this, you might designate a single host as the Smarthost. All the other machines would in turn blindly send any outbound email to the Smarthost. The smarthost would have the ability to resolve hosts and domain MX records on the internet, and would be permitted by firewall/acl/iptables/whatever to communicate to other hosts on port 25, or port 587, to deliver outbound email.
The other common use of a mail relay is with inbound email. If you run a large organization, with thousands or hundreds of thousands of users, writing email to block storage can consume a tremendous amount of time and resources. If you only had 1 server to do this, it would quickly become bogged down. If you have multiple servers, serving a subset of users each, you would have to change each user's email domain to be distinct for that user. Those workarounds become fairly inconvenient rather quickly. The solution for this is a single MX record for your domain, which might resolve (by load balancing, or DNS round-robining) to multiple mail-relay servers. These mail-relays would be configured to accept email for any users in the domain, while filtering SPAM, then it would consult it's own policies/maps to determine to which mailbox server the email needs to be forwarded to to reach the end-user's mailbox. userA => server1, userB => server2, etc.
This allows the servers that do the heavy lifting of receiving email from the internet for all the users to rapidly forward them off, while the mailbox servers having a lower individual volume, are able to incur the resource penalties of writing messages to disk, without becoming a bottleneck.
- SMTP relay is a host that accepts incoming SMTP and forwards the messages on somewhere that will get them delivered to the right place.
- SMTP smarthost is an SMTP relay that knows enough to send stuff intelligently to the right place.
Either one would normally be expected to be capable of queueing messages that temporarily couldn't be sent on, to try again later.
A relay is an MTA (Mail Transfer Agent) which will forward email to another server. Of most concern are open relays which accept email from anyone and forward to anyone. These are useful for sending spam, and many systems try to avoid accepting email from them.
Smarthosts are a class of relay server which is used to relay email for a certain group of users. ISPs typically provide a relay server which accepts email from their network and relays it to the Internet. They may require authentication.
MSAs (Mail Submission Agents) are Smarthosts which usually require authentication. There is a separate Submission port allocated for them to use. An MSA can be useful for mobile users as they allow the user to relay email using trusted mail servers.