Technical article 127049

Can I send a file directly to sendmail from the command line on my OpenServer 6.0.0 system?

OpenServer 6.0.0

Written · Last revised

Problem

I would like to be able to send an email from the command line on a system that is configured with the sendmail MTA. Is there a simple way to do this?

Solution

It is possible to send an email from the command line in OpenServer 6.0.0 using sendmail.

NOTE:     This article assumes that sendmail has been correctly configured
          to send local and non-local email.

You can send a file you have previously created as email using

# cat foobar.txt | /usr/lib/sendmail recipient@domain
where:

foobar.txt is the file you want to send as an email and recipient@domain is the recipient of the email

Please note that by default the file will be sent from your username@server_domain where

username is the user you are logged into the server as

and
server_domain is domain of the server

Please note that in foobar.txt you can define email header items such as:

Subject: <The usual subject of the email>
and
To: <recipient@domain>

You can also change who the email comes from using:

# cat foobar.txt | /usr/lib/sendmail -f username@domain recipient@domain

See also

TA#125337: "I want to create a script or use the command line to send an email with an attachment non-interactively, how can I do this?"

From the Xinuos technical article database, record 127049. Reproduced with permission. The original is at www.sco.com/ta/127049, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.