HPlogo Configuring and Managing MPE/iX Internet Services > Chapter 10 Sendmail for MPE/iX

Sending E-mail

MPE documents

Complete PDF
Table of Contents
Glossary
Index

E0802 Edition 6 ♥
E0701 Edition 5
E0400 Edition 4

The POSIX mailx command can be used to send simple e-mail messages via Sendmail. Mailx reads the file /etc/mailx.rc to determine which mail delivery program to use, and the Sendmail installation script modifies this file to specify that Sendmail shall be used. For more information about mailx, please see "man mailx" or the MPE/iX Shell & Utilities Reference Manual Vol. 1.

To send a message interactively:
  1. :XEQ SH.HPBIN.SYS -L

  2. shell/iX> mailx someuser@some.host
    Subject: hello world
    Hi,

    How are you doing?
    :EOD
    EOT

To send a message from a pipe:
  1. :XEQ SH.HPBIN.SYS -L

  2. shell/iX> echo "Hi,\n\nHow are you doing?" | \
    mailx -s "hello world" someuser@some.host

To send a message from a disk file:
  1. :XEQ SH.HPBIN.SYS -L

  2. shell/iX> /bin/cat - >/diskfile/containing/message/body
    Hi,

    How are you doing?
    :EOD

  3. shell/iX> mailx -s "hello world" someuser@some.host \
    </diskfile/containing/message/body

Mailx only gives you limited control over message headers and does not allow you to send attachments. For total control over message formatting and content, you will need to invoke Sendmail directly.

Sendmail expects you to pass it a fully formatted message via stdin that consists of both header data and body text. Note that an empty line is used to delimit where the headers end and the body text begins.

To send a message interactively:
  1. :XEQ SH.HPBIN.SYS -L

  2. shell/iX> /bin/cat - | /SENDMAIL/CURRENT/SENDMAIL someuser@some.host
    Subject: hello world

    Hi,

    How are you doing?
    :EOD

To send a message with Sendmail reading the headers to determine the recipient addresses:
  1. :XEQ SH.HPBIN.SYS -L

  2. shell/iX> /bin/cat - >message.txt
    To: someuser@some.host
    Cc: otheruser@other.host
    Bcc: secretuser@another.host
    Subject: hello world

    Hi,

    How is everybody doing?
    :EOD

  3. shell/iX> /SENDMAIL/CURRENT/SENDMAIL -t <message.txt

Note that Sendmail is merely a passive Mail Transport Agent and doesn't give you any message composition functionality to create things such as attachments. If you want to create attachments, you must manually create all of the necessary message headers yourself. These Multipurpose Internet Mail Extensions (MIME) headers are described in RFCs 2045-2049. RFCs are available from many places on the Internet; the official central repository is http://www.rfc-editor.org/. Some scripting languages contain tools to make MIME content generation easier -- for a Perl example, please see http://search.cpan.org/search?module=MIME::Lite (Perl is not supported by HP).

If the mail daemon isn't running when a local user submits a new e-mail message, the message will be queued in the /var/spool/clientmqueue directory which will be processed the next time the mail daemon job is started. Otherwise, the new message is sent to the mail daemon via TCP port 25, and the daemon queues the message in the /var/spool/mqueue directory and then attempts immediate delivery.




Configuring Sendmail


Receiving E-mail