This tutorial helps configuring sending emails from the command line:
https://www.vultr.com/docs/use-zoho-as-external-smtp-server-with-postfix-on-ubuntu-20-04
However cron still send emails to [email protected] and Zoho will bounce the message
status=bounced (host smtp.zoho.com[204.141.32.56] said: 553 Relaying disallowed as @ (in reply to end of DATA command))
https://www.linuxsysadmins.com/forcing-the-from-address-when-postfix-relays-over-smtp/
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
default_transport = smtp
relay_transport = smtp
inet_protocols = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = smtp.zoho.com:587
smtp_use_tls = yes
sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
header_checks = regexp:/etc/postfix/header_checks
If 2FA is enabled generate an application password
smtp.zoho.com:587 [email protected]:PASSWORD
and RUN
postmap sasl_passwd
/.+/ [email protected]
/From:.*/ REPLACE From: [email protected]