So all you want is to send a mail message from the command line or a script via the gmail SMTP server, yes?
Well, I can't help you to get postfix or sendmail working, but if you install msmtp, that'll send the mail for you. ssmtp would do the job too, but that would replace postfix which you might not want to do, but it does work with gmail.
For msmtp, you just need a ~/.msmtprc set up like this:
Code:
#Gmail account
defaults
logfile ~/msmtp.log
account gmail
auth on
host smtp.gmail.com
from @gmail.com
auth on
tls on
# tls_trust_file /etc/ssl/cert.pem
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
user @gmail.com
password passwd
port 587
account default : gmail
Put your details in, of course.
Then add
Code:
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"
to ~/.mailrc
After that just use the mailx command (might have to install heirloom-mailx for that) in the normal way, `mail -s "subject" person@address < message.txt`
Bookmarks