Email notifications with Gmail

Burny

New Member
Oct 17, 2024
4
1
3
Hello all, I'm having trouble configuring backup email notifications. Can anyone point in me the right direction?
Testemails remain stuck in the postqueue.


Command used to test:
Code:
echo "This is a test email body." | mail -s "Test Subject123" -a "From: me@gmail.com" recipient@domain.com


postqueue -p output, where it looks like the sender is wrong, should be "me@gmail.com".
Where can I change this?

Code:
-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
39A9C15FF9F     421 Thu Oct 17 10:42:48  root@PM-Backup.local
(lost connection with smtp.gmail.com[66.102.1.109] while receiving the initial server greeting)
                                         recipient@domain.com

-- 0 Kbytes in 1 Request.

My /etc/postfix/main.cf

Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

myhostname = PM-Backup.local

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 = [smtp.gmail.com]:465
smtp_use_tls = yes

mynetworks = 127.0.0.0/8
inet_interfaces = loopback-only
recipient_delimiter = +

# Postfix compatibility level
compatibility_level = 2

# Only use IPv4
inet_protocols = ipv4

# Security-related configurations for Gmail SMTP
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

# Gmail SMTP authentication settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain

I also configured an app password on my Gmail account that I used in the sasl_passwd file in this format and then used postmap to hash it:

Code:
[smtp.gmail.com]:465 me@gmail.com:**** **** **** ****
 
Good question. I had no idea what to put in "Endpoint Name" so I started searching the documentation and this forum. And this quickly escalated into configuring Postfix.
I had another look at the builtin plugin but I still struggle with the endpoint name. What does it mean?
 
Thank you, it works!
I must have tried 5-6 different things in that field and always got a regex error. My best guess is that it will not accept a space.
 
  • Like
Reactions: fireon

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!