(Video materials in preparation)
email : SMTP client (mail sending client)
Usage : email [options] mail_text
Options : --server <servername> (mandatory)
--port <port>
--auth <method>
--domain <hostname>
--from <mail_address> (mandatory)
--to "<mail_address>..." (mandatory)
--cc "<mail_address>..."
--bcc "<mail_address>..."
--display-from <display_name>
--display-to "<display_name>..."
--display-cc "<display_name>..."
--reply_to <mail_address>
--return_path <mail_address>
--date <date_str>
--subject <subject>
--login <loginname>
--passwd <password>
--notify <mail_address>
--misc <arbitrary_text>
--attach <filename>
--excel <excelfile>
--verbose
Version : Fri Jan 12 16:38:19 JST 2024
Edition : 2
Communicates with mail server 211.13.204.15 on the SMTP port
(default 25). User name is "demo@usp-lab.com" and password is
"Demo1234". Sends an email from sender "demo@usp-lab.com" to
recipients "to_1@usp-lab.com" and "to_2@usp-lab.com" with subject
"Test Mail" and message body "mail_text". Cc to "cc_1@usp-lab.com"
and "cc_2@usp-lab.com". Bcc to "bcc_1@usp-lab.com" and
"bcc_2@usp-lab.com". When sending, files "attach1", "attach2" and
"attach3" are attached. Also, Excel files "book1.xls" and
"book2.xls" are attached. If --verbose option is specified, the
top of "To Address"es is output to standard output after sending is
completed.
$ email --server 211.13.204.15 --port 587 \
--login demo@usp-lab.com --passwd Demo1234 \
--from demo@usp-lab.com \
--to "to_1@usp-lab.com to_2@usp-lab.com" \
--cc "cc_1@usp-lab.com cc_2@usp-lab.com" \
--bcc "bcc_1@usp-lab.com bcc_2@usp-lab.com" \
--subject 'Test Mail' \
--attach attach1 --attach attach2 --attach attach3 \
--excel book1.xls --excel book2.xls \
--verbose mail_text
--server --from --to are mandatory.
If --domain is omitted, host name is used.
--to --cc --bcc can specify multiple addresses. Each address group
must be surrounded by double-quotes. Alternately, you can specify
the option multiple times (Example: --to addr1@domain1 --to
addr2@damin2)
--login --passwd are only compatible with ESMTP CRAM-MD5, LOGIN or
PLAIN authentication. If the server supports multiple
authentication methods, all of the above methods will be tried in
the order written above unless --auth is specified.
If --auth <method> is specified, the following occurs:
--auth none No authentication
--auth auto As described above
--auth server Server specifies which method to use
--auth cram-md5 CRAM-MD5 only
--auth login LOGIN only
--auth plain PLAIN only
If you do not specify --return_path or --reply_to then the address
specified in --from will be used automatically. If you do specify
--return_path then the MAIL FROM: field in the mail envelope will be
overwritten with the specified address.
You can specify arbitrary header field with --misc option. This
option can be specified multiple times, and specfied text is output
in the specfied order. This option does not check validness. If
you wan to specify continuation line, insert space to top of
<arbitrary_text>.
When using --attach, the Content-Type is set to
application/octet-stream while when using --excel
it is application/vnd.ms-excel.
When using FreeBSD, please compile with the command below:
$ cc -static -O3 -I/usr/local/include -L/usr/local/lib -o email \
email.c -liconv