node (datacenter) not sending emails

vikozo

Renowned Member
May 4, 2014
781
31
93
suisse
www.wombat.ch
hello
on my Datacenter (node) i defined a email address in user root!
But this address never get news or Information

do i have to install mailutils or postfix
to forward a email?

have a nice day
vinc
 
do i have to install mailutils or postfix
I think so. At least that's what I did on my box.
However that has been upgraded from a 5.0 release, not sure how that is handled as of todays installer.
 
Installing MTA for outbound mailing isn't trivial because there are so much various options how to do things.
Due to that it is hard to automate... Especially when using a Smart-Host (as usual with gear at home, which uses some g00gle mail address or similar).
 
for my setup it is a bit more than what you have described.
Happy to share what I did:

First install mailutils and postfix
Code:
sudo apt-get install mailutils
sudo apt-get install postfix
# TYP > Satellite system
# FQDN > my.proxmox.host
# SMARTHOST > my.smart.host (e.g. mail server)

Then setup the local MTA (Part 1 - master.cf):
Code:
### POSTFIX
sudo cp /etc/postfix/master.cf /etc/postfix/master.cf.ori
sudo vi /etc/postfix/master.cf

#File Content Start >>>>
### MTA without encryption. Running on localhost only
127.0.0.1:25 inet    n       -       -       -       -       smtpd
  -o smtpd_delay_reject=no
  -o smtpd_client_restrictions=permit_mynetworks,reject
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o smtpd_data_restrictions=reject_unauth_pipelining
  -o mynetworks=127.0.0.0/8
  -o smtpd_error_sleep_time=0
  -o smtpd_soft_error_limit=1001
  -o smtpd_hard_error_limit=1000
  -o smtpd_client_connection_count_limit=0
  -o smtpd_client_connection_rate_limit=0
  -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks

#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
#  -v
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
  -o smtp_fallback_relay=
#  -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix    -    n    n    -    2    pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}
#File Content End >>>>

Next setup the local MTA (Part 2 - main.cf):
Code:
sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.ori
sudo vi /etc/postfix/main.cf

#File Content Start >>>>
smtpd_banner = $myhostname ESMTP $mail_name (Proxmox)
biff = no
append_dot_mydomain = no
readme_directory = no

# Sending mails
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

myhostname = my.proxmox.host
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_interfaces = localhost
inet_protocols = ipv4

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =

relayhost = [my.smart.host]:submission

# Authentication options
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwords
smtp_sasl_security_options =
smtp_always_send_ehlo = yes
broken_sasl_auth_clients = yes

mailbox_size_limit = 0
recipient_delimiter = +
message_size_limit = 13002342400
#File Content End >>>>

Create relay_passwords (authentication to be used on smarthost)
Code:
sudo vi /etc/postfix/relay_passwords
#File Content Start >>>>
#[SERVER]                [USERNAME]:[PASSWORD]
my.smart.host            myusername:mypassword
#File Content End >>>>

sudo chmod 600 /etc/postfix/relay_passwords
sudo postmap /etc/postfix/relay_passwords

Restart postfix service
Code:
sudo service postfix restart

Setup aliases
Code:
sudo vi /etc/aliases
#Start File Content >>>>
# See man 5 aliases for format
postmaster:    root
root:          root@mydomain.com
#End File Content >>>>

# generate new aliases
sudo newaliases

test sending a mail.
Code:
echo "This is the body of the email" | sudo mail -s "This is the subject line" myrecipient@mydomain.com

No problem installing this on the Proxmox host itself. It is ultimately a Linux box...
 
@vikozo @tburger and others: Postfix is pre-installed as MTA in Proxmox distribution as well as Proxmox Debian template, but it's broken (it must be noticed that the Debian default MTA is Exim, so that's certainly Proxmox team work).

It's not difficult to repair it, however. To be able to send mails inside the system as well as outgoing, you just have to add to /etc/postfix/main.cf the line:
Code:
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
Morover, if you use IPv6 you must also add the corresponding local address to mynetworks:
Code:
mynetworks = 127.0.0.0/8 [::1]/128

It seems for me that this is a bug in Proxmox distribution as well as debian templates. It would be good both to be distributed with a functional configuration for IPv4 and IPv6.
 
  • Like
Reactions: vikozo

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!