Meu favorito é o e-mail (). É realmente simples, sem necessidade de configuração complexa, sem necessidade de dependências. E você pode especificar o argumento smtp-server via linha de comando, o que significa que é mais adequado para o script. A única pena é que a maioria das distribuições Linux não contém esta ferramenta, então você precisa compilá-la você mesmo.
Citações de email projet no github
Q: What is 'email' ?
A: 'email' is a program I designed that will send email via the
command line
to remote smtp servers or use 'sendmail' internally, and fully interact with
GNUPG to encrypt and sign your e-mails, so you decide to do so...
You can get GNUPG at: http://www.gnupg.org
Agradecemos cygwin por me informar sobre este útil e-mail cliente.
Compile e instale
./configure
make
./install.sh --version 3.1.3 --prefix /usr --mandir /usr/share/man --sysconfdir /etc
Opções de linha de comando de email
$ email --help
Options information is as follows
email [options] recipient1,recipient2,...
-h, -help module Print this message or specify one of the below options
-V, -verbose Display mailing progress.
-f, -from-addr Senders mail address
-n, -from-name Senders name
-b, -blank-mail Allows you to send a blank email
-e, -encrypt Encrypt the e-mail for first recipient before sending
-s, -subject subject Subject of message
-r, -smtp-server server Specify a temporary SMTP server for sending
-p, -smtp-port port Specify the SMTP port to connect to
-a, -attach file Attach file and base64 encode
-c, -conf-file file Path to non-default configuration file
-t, -check-config Simply parse the email.conf file for errors
-x, -timeout Set socket timeout.
-cc email,email,... Copy recipients
-bcc email,email,... Blind Copy recipients
-sign Sign the email with GPG
-html Send message in HTML format ( Make your own HTML! )
-tls Use TLS/SSL
-m, -smtp-auth type Set the SMTP AUTH type (plain or login)
-u, -smtp-user username Specify your username for SMTP AUTH
-i, -smtp-pass password Specify your password for SMTP AUTH
-g, -gpg-pass Specify your password for GPG
-H, -header string Add header (can be used multiple times)
-high-priority Send the email with high priority
-no-encoding Don't use UTF-8 encoding
Uso de amostra
Correio simples com o servidor SMTP especificado
echo "mail body" | email -subject "unix.stackexchange.com Q36982" -from-name LiuYan刘研 -from-addr [email protected] -smtp-server smtp.domain.com -smtp-port 25 [email protected] [email protected]
correio HTML
echo "<h1>header</h1><p>paragraph</p>" | email -html -subject "unix.stackexchange.com Q36982 HTML mail" [email protected]
Anexo (s)
echo "see the attachment(s)" | email -subject "This is my email.conf file" -attach /etc/email/email.conf -attach [email protected]