0

I am new to managing a VPS. The host name for my vps is vps.techbreeze.in and recently I discovered that if i try to send a mail to an address like say [email protected] the email gets sent to the /var/spool/mail/root However if I send an email to say another of my account, [email protected] the email goes to the inbox. How do I configure the emails to get sent to my inbox rather than the spool/mail/ The VPS I have doesn't have any dns configured runs on vhost and has one dedicated IP.

1 Answer 1

4

Typically a lot of scripts, cronjobs and such will generate output that gets send by email to the operator. The only garanteed operator account to exists on all Linux/Unix boxes is root, so that becomes the default mail recipient.

The same holds for email that bounces and can't get delivered.

Typically the administrator will configure the system to forward mail addressed to root to an user acount (locally or remote). The default is via /etc/aliases

# Basic system aliases -- these MUST be present.
mailer-daemon:  postmaster
postmaster:     root
# Forward all mail to root to Rick
root:           [email protected] 

If your VPS comes with sendmail you need to run newaliases to activate the changes.

To route email you need DNS so start by confuguring DNS. Edit /etc/resolv.conf and add the following lines:

# /etc/resolv.conf
# Use Google's public DNS servers
nameserver 8.8.4.4
nameserver 8.8.8.8

Often this is already sufficient to send email.

1
  • Is there a good way to intercept these root mails? Since they are mostly notifications etc, I prefer they get forwarded out via webhooks/telegram etc
    – bilogic
    May 17, 2023 at 2:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .