Just set up postfix for notification messages but I don't have real hostname since this is just a home lab. Postfix is set up to relay through gmail
main.cf
This works but my email goes to root@pve.home.com and bcc to my personal email which I added to root user in proxmox at install. To fix this I added "root: someone@example.com" to the aliases, ran newaliases and restart postfix. The result is not when I run the following test the message only sends to personal as bcc.
echo -e "Subject:Hello World \n\n Testing email\n" | sendmail root
This result is OK I guess but seems odd. Shouldn't it send to my personal email instead of only BCC since I have a aliases setup?
Spoke to soon, I switched my test and that resulted in the difference. "sendmail" sends only to BCC but:
echo "testing" | mail -s "test message" root
Send email to root@pve.home.com as it turns out just like Cron Daemon does.
main.cf
Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
myhostname=pve.home.com
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
#relayhost =
mynetworks = 127.0.0.0/8
inet_interfaces = loopback-only
recipient_delimiter = +
# sets gmail as relay
relayhost = [smtp.gmail.com]:587
# use tls
smtp_use_tls=yes
# use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes
# path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# list of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/Equifax_Secure_CA.pem
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtp_tls_session_cache_timeout = 3600s
# eliminates default security options which are imcompatible with gmail
smtp_sasl_security_options =
This works but my email goes to root@pve.home.com and bcc to my personal email which I added to root user in proxmox at install. To fix this I added "root: someone@example.com" to the aliases, ran newaliases and restart postfix. The result is not when I run the following test the message only sends to personal as bcc.
echo -e "Subject:Hello World \n\n Testing email\n" | sendmail root
This result is OK I guess but seems odd. Shouldn't it send to my personal email instead of only BCC since I have a aliases setup?
Spoke to soon, I switched my test and that resulted in the difference. "sendmail" sends only to BCC but:
echo "testing" | mail -s "test message" root
Send email to root@pve.home.com as it turns out just like Cron Daemon does.
Last edited: