Email for standalone servers

From techdocs
Revision as of 10:55, 23 October 2023 by Plinich (talk | contribs)
Jump to navigation Jump to search

Various individuals and groups within CSE run their own servers "in the cloud" (read: AWS) which need email capability.

Email can be managed completely (i.e., sending and receiving) on the server, or some or all of the management can be offloaded to an email hosting service (e.g., Rackspace, where CSE has an account).

In this article we talk about the the different possibilities and which might be more appropriate in some use cases than others.

Incoming email

For incoming email the server can:

  1. Run an email service, such as PostFix, which will receive emails directly and deliver them to local mailbox files, or
  2. Can pick up emails with scripts using IMAP from an external email hosting provider. CSE has an account with Rackspace for this latter purpose and we can create mailboxes on their systems in the "cseunsw.tech" domain, e.g., "myemail@cseunsw.tech".

Outgoing email

For outgoing email the server can:

  1. Run an email service, such as PostFix, which queues and sends emails either directly to the recipients' email servers, or to a "smart host" which then delivers the emails to the recipients' email servers. This latter approach is indicated when the local server is not always running (and thus cannot retry if an email can't be delivered), or when a security concern means you don't want your server to talk directly to untrusted/random destination servers, or
  2. Send emails using scripts via an external email hosting provider. Mailboxes created in above mentioned account with Rackspace means email can be sent via their servers using curl.

Structure sketch

  • Create an SPF record for the server's sending domain containing its IP address
  • Using PostFix to send email
    • Configure the full domain in /etc/hostname
  • Mailboxes managed by Rackspace
    • The cseunsw.tech domain mail exchangers (MX)
    • Using Rackspace's email servers to send email as a single user
      • Sending email using curl
      • Using PostFix
    • Rackspace mailboxes
      • Simple email, not Exchange
      • Picking up email using IMAP
      • Forwarding email from a cse.unsw.edu.au address using mlalias
  • Configuring a server to send email as cse.unsw.edu.au
    • Add IP address to authorisedsenders.cseunsw.tech TXT record
    • /etc/postfix/main.cf