搜尋此網誌

2016/5/28

[linux,mail]linux上可以使用的寄信程式

官網
http://www.logix.cz/michal/devel/smtp-cli/
smtp-cli github
https://github.com/mludvig/smtp-cli


主管推薦發送mail的軟體,完全符合RFC規定
perl開發的,不用因為需要寄信出去而把自己變成mail server,然後再關閉收件功能

套件會用到epel,要先裝epel
redhat、centos
yum  install  perl-IO-Socket-SSL  perl-Digest-HMAC  perl-TermReadKey  \
 perl-MIME-Lite  perl-File-LibMagic  perl-IO-Socket-INET6


Usage: smtp-cli [--options]

        --server=<hostname>[:<port>] 指定伺服器位置或直接加上port
                                Host name or IP address of the SMTP server.
                                May include the port after colon, alternatively
                                use --port.
        --port=<number>         Port where the SMTP server is listening.
                                (default: 25)

        -4 or --ipv4            Use standard IP (IPv4) protocol.
        -6 or --ipv6            Use IPv6 protocol. For hosts that have
                                both IPv6 and IPv4 addresses the IPv6
                                connection is tried first.

        --hello-host=<string>   String to use in the EHLO/HELO command.
        --disable-ehlo          Don't use ESMTP EHLO command, only HELO.
        --force-ehlo            Use EHLO even if server doesn't say ESMTP.

        Transport encryption (TLS)
        --disable-starttls      Don't use encryption even if the remote
                                host offers it.
        --ssl                   Start in SMTP/SSL mode (aka SSMTP).
                                Default when --port=465
        --disable-ssl           Don't start SSMTP even if --port=465
        --ssl-ca-file=<filename>
                                Verify the server's SSL certificate against
                                a trusted CA root certificate file.
        --ssl-ca-path=<dirname> Similar to --ssl-ca-file but will look for
                                the appropriate root certificate file in
                                the given directory. The certificates must
                                must be stored one per file with hash-links
                                generated by, for example, c_rehash script
                                from OpenSSL.

        Authentication options (AUTH)
        --user=<username>       Username for SMTP authentication.
        --pass=<password>       Corresponding password.
        --auth-login            Enable only AUTH LOGIN method.
        --auth-plain            Enable only AUTH PLAIN method.
        --auth-cram-md5         Enable only AUTH CRAM-MD5 method.
        --auth                  Enable all supported methods. This is
                                normally not needed, --user enables
                                everything as well.

        Sender / recipient
        --from=\"Display Name <add\@re.ss>\"
                                Sender's name address (or address only).
        --to=\"Display Name <add\@re.ss>\"
        --cc=\"Display Name <add\@re.ss>\"
        --bcc=\"Display Name <add\@re.ss>\"
                                Message recipients. Each parameter can be
                                used multiple times.
                                The --bcc addresses won't apprear in
                                the composed message.

        SMTP Envelope sender / recipient
        (rarely needed, use --from, --to, --cc and --bcc instead)
        --mail-from=<address>   Address to use in MAIL FROM command.
                                Use --from instead, unless you want
                                a different address in the envelope and
                                in the headers.
        --rcpt-to=<address>     Address to use in RCPT TO command. Can be
                                used multiple times. Normally not needed,
                                use --to, --cc and --bcc instead.
                                If set the --to, --cc and --bcc will only
                                be used for composing the message body and
                                not for delivering the messages.

        Send a complete RFC822-compliant email message:
        --data=<filename>       Name of file to send after DATA command.
                                With \"--data=-\" the script will read
                                standard input (useful e.g. for pipes).

        Alternatively build email a message from provided components:
        --subject=<subject>     Subject of the message
        --body-plain=<text|filename>
        --body-html=<text|filename>
                                Plaintext and/or HTML body of the message
                                If both are provided the message is sent
                                as multipart.
        --charset=<charset>     Character set used for Subject and Body,
                                for example UTF-8, ISO-8859-2, KOI8-R, etc.
        --text-encoding=<encoding>
                                Enforce Content-Transfer-Encoding for text
                                parts of the email, including body and
                                attachments. Must be one of:
                                ".join(", ", @valid_encodings)."
                                The default is: quoted-printable
        --attach=<filename>[\@<MIME/Type>]
                                Attach a given filename.
                                MIME-Type of the attachment is guessed
                                by default guessed but can optionally
                                be specified after '\@' delimiter.
                                For instance: --attach mail.log\@text/plain
                                Parameter can be used multiple times.
        --attach-inline=<filename>[\@<MIME/Type>]
                                Attach a given filename (typically a picture)
                                as a 'related' part to the above 'body-html'.
                                Refer to these pictures as <img src='cid:filename'>
                                in the 'body-html' contents.
                                See --attach for details about MIME-Type.
                                Can be used multiple times.
        --add-header=\"Header: value\"
        --replace-header=\"Header: value\"
        --remove-header=\"Header\"
                                Add, Replace or Remove pretty much any header
                                in the email. For example to set a different
                                Mailer use --replace-header=\"X-Mailer: Blah\",
                                to remove it altogether --remove-header=X-Mailer
                                or to add a completely custom header use
                                --add-header=\"X-Something: foo bar\".
        --print-only            Dump the composed MIME message to standard
                                output. This is useful mainly for debugging
                                or in the case you need to run the message
                                through some filter before sending.

        Other options
        --verbose[=<number>]    Be more verbose, print the SMTP session.
        --missing-modules-ok    Don't complain about missing optional modules.
        --version               Print: smtp-cli version $version
        --help                  Guess what is this option for 

沒有留言: