Next: sendmail script invoking, Up: sendmail script [Contents][Index]
Let’s say we have a file named message.mail holding a fully composed email message:
Sender: marco@localhost From: marco@localhost To: root@localhost Subject: server on fire? I noticed flames raising from the server room... -- Marco
basically, to send it with sendmail-mbfl.sh
we have to do:
$ sendmail-mbfl.sh \ --envelope-from=marco@localhost \ --envelope-to=root@localhost \ --message=message.mail
by default the SMTP server name is set to localhost
and the TCP port to 25
. The
default session is plain, without TLS.
Port number 25
is officially assigned to the SMTP protocol; if the localhost uses a
different TCP port, we can select it with the --port option:
$ sendmail-mbfl.sh --port=587 \ --envelope-from=marco@localhost \ --envelope-to=root@localhost \ --message=message.mail
To send mail to a remote SMTP server, we select its hostname with the --host option:
$ sendmail-mbfl.sh \ --host=smtp.gmail.com --port=587 \ --envelope-from=marco@gmail.com \ --envelope-to=marco@spiffy.it \ --message=message.mail
Mail services may offer encrypted sessions to their SMTP servers. Encryption with the TLS
protocol is supported by sendmail-mbfl.sh
through external programs. Whether a server
requires an encrypted session, can be specified using the --plain, --tls or
--starttls options.
To establish an encrypted session, the script needs to acquire the credentials of the user. These can be stored in a configuration file named ~/.mbfl-authinfo, which looks like this:
machine smtp.gmail.com login marco@gmail.com password abcdefghilm machine relay.poste.it login marco@poste.it password 0123456789
so that a line/record can be uniquely identified with values of the --host and --username options.
So we can do:
$ sendmail-mbfl.sh --host=gmail \ --username=marco --starttls \ --envelope-from=marco@gmail.com \ --envelope-to=marco@spiffy.it \ --message=message.mail
Next: sendmail script invoking, Up: sendmail script [Contents][Index]