title: Postfix Username and Password not accepted (BadCredentials)
body: <p>and thank you for reading. I know this question has been asked many times - I've read a ton of different answers, and have tried most of them. None of them have worked so far. I'm pretty new to using postfix and appreciate any assistance you can provide.</p>
  
  <p>I'm using Proxmox 6.1, on Debian buster. I'm attempting to use the email function for failed backups. My domain is using Gsuite mail. I have setup the SMTP relay with both my ipv4 and ipv6 public addresses, and I have verified the credentials are correct and generated new .db each time I made a change. </p>
  
  <p>My sasl_passwd</p>
  
  <pre><code>smtp-relay.gmail.com:587   root@mydomain.com:password
  </code></pre>
  
  <p>My main.cf (domain &amp; ip have been edited)</p>
  
  <pre><code># See /usr/share/postfix/main.cf.dist for a commented, more complete version
  
  #myhostname=pve.myisp (auto generated)
  
  myhostname = mydomain.com
  
  
  #G-Suite relay test
  relayhost = smtp-relay.gmail.com:587
  
  # Use tls
  smtp_use_tls = yes
  smtp_tls_security_level = encrypt
  tls_random_source = dev:/dev/urandom
  
  # 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/ca-certificates.crt
  
  # Eliminates default security options which are imcompatible with gmail
  smtp_sasl_security_options = noanonymous
  smtp_sasl_mechanism_filter = plain
  
  compatibility_level = 2
  </code></pre>
  
  <p>Error logs:</p>
  
  <pre><code>Apr 30 16:45:52 pve postfix/qmgr[34586]: 4B3AD320C9A: from=&lt;root@mydomain.com&gt;, size=396, nrcpt=1 (queue active)
  Apr 30 16:45:54 pve postfix/smtp[34617]: 4B3AD320C9A: SASL authentication failed; server smtp-relay.gmail.com[74.125.30.28] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials m33sm110720uad.2 - gsmtp
  Apr 30 16:45:54 pve postfix/smtp[34617]: 4B3AD320C9A: to=&lt;mypersonalemail@gmail.com&gt;, relay=smtp-relay.gmail.com[2607:f8b0:4003:c0b::1c]:587, delay=2.6, delays=0.05/0.06/2.4/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp-relay.gmail.com[2607:f8b0:4003:c0b::1c] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials v7sm169048ooo.20 - gsmtp)
  </code></pre>