Re: How does mailutils "mail" command or cron contact local MTA?

2022-09-18 Thread Teemu Likonen
* 2022-09-18 09:00:49-0400, Greg Wooledge wrote:

> In normal usage, scripts should always be calling mailx or an
> equivalent program which is *designed* to create the e-mail headers
> correctly. This is especially true if you're sending attachments.
> Writing the MIME headers and attachment markup yourself is not going
> to be fun.

Mailx, or even better, Mutt:

mutt  [-nx] [-e command] [-F rcfile] [-b bcc-addr] [-c cc-addr]
  [-s subject] [-a file ... --] to-addr ... < message

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462


signature.asc
Description: PGP signature


Re: How does mailutils "mail" command or cron contact local MTA?

2022-09-18 Thread Greg Wooledge
On Sun, Sep 18, 2022 at 09:27:46AM +0200, Yvan Masson wrote:
> So the `mailutils` package with `mail` command is optional: `sendmail` could
> be used directly in scripts (but it might be a bit less practical to use,
> see for example https://www.computerhope.com/unix/usendmai.htm#examples).

If you call /usr/sbin/sendmail, you have to write all of the headers
yourself, with correct (or at least acceptably close) syntax.

The only time a shell script should be calling /usr/sbin/sendmail directly
is when you're trying to do something that your MUA (mailx, et al.) doesn't
allow, such as forging a bogus Date: header, or overriding the envelope
sender address.

In normal usage, scripts should always be calling mailx or an equivalent
program which is *designed* to create the e-mail headers correctly.  This
is especially true if you're sending attachments.  Writing the MIME headers
and attachment markup yourself is not going to be fun.



Re: How does mailutils "mail" command or cron contact local MTA?

2022-09-18 Thread Yvan Masson

Le 18/09/2022 à 00:32, Greg Wooledge a écrit :

On Sat, Sep 17, 2022 at 11:11:51PM +0200, Yvan Masson wrote:

My question is: how cron daemon and mail command know that they should
contact openSMTPd, and how? Do they try by default on localhost:25 or
/run/smtpd.sock? I could not find any clue, nor in cron manpages nor in
mailutils online documentation.


mail(1) or mailx(1) or similar utilities run the /usr/sbin/sendmail
program to inject a new message into the local MTA.

/usr/sbin/sendmail was of course originally provided by the sendmail
package.  But later MTAs implement a /usr/sbin/sendmail compatible wrapper
so that all the utilities that send mail don't have to change.


Thanks Greg!

Indeed, just to confirm for other interested on this topic, this is 
documented for `mail` command on 
https://mailutils.org/manual/mailutils.html#Mail-Variables, and for 
Vixie/ISC cron (default cron daemon on Debian) on 
https://salsa.debian.org/debian/cron/-/blob/master/config.h.


So the `mailutils` package with `mail` command is optional: `sendmail` 
could be used directly in scripts (but it might be a bit less practical 
to use, see for example 
https://www.computerhope.com/unix/usendmai.htm#examples).


Regards,
Yvan


OpenPGP_signature
Description: OpenPGP digital signature


Re: How does mailutils "mail" command or cron contact local MTA?

2022-09-17 Thread Greg Wooledge
On Sat, Sep 17, 2022 at 11:11:51PM +0200, Yvan Masson wrote:
> My question is: how cron daemon and mail command know that they should
> contact openSMTPd, and how? Do they try by default on localhost:25 or
> /run/smtpd.sock? I could not find any clue, nor in cron manpages nor in
> mailutils online documentation.

mail(1) or mailx(1) or similar utilities run the /usr/sbin/sendmail
program to inject a new message into the local MTA.

/usr/sbin/sendmail was of course originally provided by the sendmail
package.  But later MTAs implement a /usr/sbin/sendmail compatible wrapper
so that all the utilities that send mail don't have to change.



How does mailutils "mail" command or cron contact local MTA?

2022-09-17 Thread Yvan Masson

Hi,

I have some servers successfully configured to send notification emails, 
but I do not exactly understand how it works :-)


I have installed openSMTPd and configured it to forward email to a relay 
(another SMTP server, the one from my email provider). I have also set 
up aliases in `/etc/aliases`. This allows me to  send email from my 
servers, either when cron runs a task, or when I run `echo my_content | 
mail -s subject root` from scripts.


My question is: how cron daemon and mail command know that they should 
contact openSMTPd, and how? Do they try by default on localhost:25 or 
/run/smtpd.sock? I could not find any clue, nor in cron manpages nor in 
mailutils online documentation.


Regards,
Yvan


OpenPGP_signature
Description: OpenPGP digital signature


Re: replacement for mail command

2004-03-28 Thread Alexis Huxley
On 2004-03-28, Dafydd Blaidd <[EMAIL PROTECTED]> wrote:
> Greetings,
>   I switched from a system on Red Hat using Sendmail/Cyrus to a
> system using Exim/uw-imapd and I'm looking for a replacement for the mail
> command.  Specifically, I'm looking for a command line mailer that allows
> Subject: and Cc: header arguements.
>
> Recommendations?

mutt. Yes, normally it is used interactively, but it provides a wealth
of options that mean this can be automated:

date | mutt -s "hello" -c [EMAIL PROTECTED] [EMAIL PROTECTED]

or 

mutt -s "hello" -c [EMAIL PROTECTED] -i pre-prepared.contents.file [EMAIL 
PROTECTED] < /dev/null

Alexis


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: replacement for mail command

2004-03-28 Thread Paul Johnson
Dafydd Blaidd <[EMAIL PROTECTED]> writes:

> Greetings,
>   I switched from a system on Red Hat using Sendmail/Cyrus to a
> system using Exim/uw-imapd and I'm looking for a replacement for the mail
> command.  Specifically, I'm looking for a command line mailer that allows
> Subject: and Cc: header arguements.

You mean, like, all of them?

-- 
 .''`. Paul Johnson <[EMAIL PROTECTED]>
: :'  :
`. `'` proud Debian admin and user
  `-   Debian.  Because it *must* work.  debian.org   aboutdebian.com


pgp0.pgp
Description: PGP signature


Re: replacement for mail command

2004-03-27 Thread John Hasler
Dave Majors writes:
> I'm getting
> -su: mail: command not found

> I can't find either the command nor the package that contains it.

It appears that it is now in the seperate 'mailx' package. It's priority
important, though.
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: replacement for mail command

2004-03-27 Thread Dafydd Blaidd
On Sat, 27 Mar 2004, John Hasler wrote:

> > I'm looking for a command line mailer that allows Subject: and Cc:
> > header arguements.

> Just use the 'mail' command.  It isn't unique to Sendmail.

I'm getting
-su: mail: command not found

I can't find either the command nor the package that contains it.

--

Dave Majors
[EMAIL PROTECTED] (subscribed)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: replacement for mail command

2004-03-27 Thread John Hasler
Dave Majors writes:
> I switched from a system on Red Hat using Sendmail/Cyrus to a system
> using Exim/uw-imapd and I'm looking for a replacement for the mail
> command.  Specifically, I'm looking for a command line mailer that allows
> Subject: and Cc: header arguements.

> Recommendations?

Just use the 'mail' command.  It isn't unique to Sendmail.
-- 
John Hasler   You may treat this work as if it 
[EMAIL PROTECTED]   were in the public domain.
Dancing Horse HillI waive all rights.
Elmwood, Wisconsin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



replacement for mail command

2004-03-27 Thread Dafydd Blaidd
Greetings,
I switched from a system on Red Hat using Sendmail/Cyrus to a
system using Exim/uw-imapd and I'm looking for a replacement for the mail
command.  Specifically, I'm looking for a command line mailer that allows
Subject: and Cc: header arguements.

Recommendations?

--

Dave Majors
[EMAIL PROTECTED] (subscribed)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: adding an attatchment using the mail command?

2004-01-08 Thread Cristian Gutierrez
Mark C. <[EMAIL PROTECTED]> writes:

>Hi,
>
>I run a nightly cronjob to back up certain system files, for the life
>of me I cannot add them as an attatchment, when I mail to files to
>myself, they always got put into the message body.  Reading the man
>pages gives no indication of how to do this, and I'm not sure if you
>can with the 'mail' command (I suppose sendmail would be the other
>alternative).
>
>and googling fails to come up with the correct results (probally my
>search string).

I always do something like this:

  mutt -a some_file -a other_file ... [EMAIL PROTECTED] < mesage_body.txt

and works pretty good :-)

-- 
Cristian Gutierrez  http://www.dcc.uchile.cl/~crgutier
[EMAIL PROTECTED]Jabber:[EMAIL PROTECTED]

the premature program optimization is the root of all evils


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: adding an attatchment using the mail command?

2004-01-07 Thread Antonio Rodriguez
On Wed, Jan 07, 2004 at 04:01:27PM +, Mark C wrote:
> Hi,
> 
> I run a nightly cronjob to back up certain system files, for the life of
> me I cannot add them as an attatchment, when I mail to files to myself,
> they always got put into the message body.  Reading the man pages gives
> no indication of how to do this, and I'm not sure if you can with the
> 'mail' command (I suppose sendmail would be the other alternative).
> 
> and googling fails to come up with the correct results (probally my
> search string).
> 
> Any advise would be appreciated
> 
> Regards
> 
> Mark
> 

Hi Mark, try biabam


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: adding an attatchment using the mail command?

2004-01-07 Thread Mark C
On Wed, 2004-01-07 at 17:13, Morten Bo Johansen wrote:

> You can't do it with 'mail'. You can use 'nail' instead which does
> attachments. If you already have mutt installed you can use that as
> well to send mail with attachments in batch mode.

Cheers, I do have mutt installed, which is what I generally use when
working remotely, will give nail a bash..

Cheers

Mark


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: adding an attatchment using the mail command?

2004-01-07 Thread Morten Bo Johansen
On Wed, 7 Jan 2004 16:01:27 - (GMT) Mark C wrote:

> I run a nightly cronjob to back up certain system files, for the life of
> me I cannot add them as an attatchment, when I mail to files to myself,
> they always got put into the message body.  Reading the man pages gives
> no indication of how to do this, and I'm not sure if you can with the
> 'mail' command (I suppose sendmail would be the other alternative).

You can't do it with 'mail'. You can use 'nail' instead which does
attachments. If you already have mutt installed you can use that as
well to send mail with attachments in batch mode.


HTH,

Morten


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: adding an attatchment using the mail command?

2004-01-07 Thread Uwe Dippel
On Wed, 07 Jan 2004 16:01:27 +, Mark C wrote:

> I run a nightly cronjob to back up certain system files, for the life of
> me I cannot add them as an attatchment, when I mail to files to myself,
> they always got put into the message body.  Reading the man pages gives
> no indication of how to do this, and I'm not sure if you can with the
> 'mail' command (I suppose sendmail would be the other alternative).

Not really, I'm afraid. RFC822 doesn't have it on attachments and mime
(yet). So your mail -s "My backup" [EMAIL PROTECTED] < backupfile necessarily
ends that file up in the message body. And 'mail' is just a frontend to
the Mail Transfer Agent; e.g. sendmail.

In order to help you further, you better specify more details. Some ftp /
nc / nfs might be useful here, depending on the circumstances.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



adding an attatchment using the mail command?

2004-01-07 Thread Mark C
Hi,

I run a nightly cronjob to back up certain system files, for the life of
me I cannot add them as an attatchment, when I mail to files to myself,
they always got put into the message body.  Reading the man pages gives
no indication of how to do this, and I'm not sure if you can with the
'mail' command (I suppose sendmail would be the other alternative).

and googling fails to come up with the correct results (probally my
search string).

Any advise would be appreciated

Regards

Mark




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re[2]: mail: command not found

2002-04-01 Thread Alan Poulton
Monday, April 01, 2002, 12:48:01 PM, Eric G. Miller wrote:

> apt-get install mailx.

Excellent, thank you!

> If you like such a program, you might like nmh...

I got it and am reading the manual on it. It looks interesting, but may
be more commands to remember on a router. =]

-- 
  - Alan Poulton ([EMAIL PROTECTED]) -
Confucius say: Man who put head in fruit drink get punch in nose.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: mail: command not found

2002-04-01 Thread Eric G. Miller
On Mon, Apr 01, 2002 at 12:29:06PM -0800, Alan Poulton wrote:
> Hi all
> 
> I seem to have lost my "mail" command. When I log on, either as my
> regular account, or as root to do some sysadmin'ing, I get a message
> saying "You have new mail" and I used to be able to just type "mail" to
> access it.  But, as of yesterday, I get "mail: command not found". I've
> done an updatedb and a locate mail to try to locate it, and it's just
> not there.
> 
> How can I go about re-installing this mail thing?

apt-get install mailx.

If you like such a program, you might like nmh...

-- 
Eric G. Miller 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



mail: command not found

2002-04-01 Thread Alan Poulton
Hi all

I seem to have lost my "mail" command. When I log on, either as my
regular account, or as root to do some sysadmin'ing, I get a message
saying "You have new mail" and I used to be able to just type "mail" to
access it.  But, as of yesterday, I get "mail: command not found". I've
done an updatedb and a locate mail to try to locate it, and it's just
not there.

How can I go about re-installing this mail thing?

-- 
  - Alan Poulton ([EMAIL PROTECTED]) -
Confucius say: Can not change wife of 40 for two twenties


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Getting the "mail" command to work

2001-05-01 Thread Shaul Karl
> Does anyone know what needs to be done in order to get the mail command to 
> work?
> 
> Right now I'm trying to do:
> 
>mail -s "test from command line" [EMAIL PROTECTED]
> 
> I I have postfix installed.
> 


Have you installed mailx?

[11:23:06 tmp]$ dpkg -S $(which mail)
mailx: /usr/bin/mail
[11:23:23 tmp]$ 
-- 

Shaul Karl <[EMAIL PROTECTED]>




Re: Getting the "mail" command to work

2001-04-30 Thread Ethan Benson
On Mon, Apr 30, 2001 at 05:27:33AM -0500, Stephen Boulet wrote:
> Does anyone know what needs to be done in order to get the mail command to 
> work?
> 
> Right now I'm trying to do:
> 
>mail -s "test from command line" [EMAIL PROTECTED]
> 
> I I have postfix installed.

if it doesn't work then something is wrong with your postfix setup.
check your mail logs for hints as to whats going wrong.  postfix is
generally pretty easy to get going.  

-- 
Ethan Benson
http://www.alaska.net/~erbenson/


pgp46Q5G0jfAt.pgp
Description: PGP signature


Getting the "mail" command to work

2001-04-30 Thread Stephen Boulet
Does anyone know what needs to be done in order to get the mail command to 
work?

Right now I'm trying to do:

   mail -s "test from command line" [EMAIL PROTECTED]

I I have postfix installed.



Re: Mail command

1997-09-18 Thread Alex Yukhimets
> Hi,
> 
> As I am on a university network I have no right to send mail on my
> machine. So I haven't installed any mail software until now. However, I
> have set up my web page with stuff for downloading and a form. I would
> like to have the cgi script to send an internal mail to a user on my
> machine , no mail messages will be leaving the machine. Thw script
> requires the binary /usr/bin/mail , the standard mail program, or
> equivalent,  which I
> haven't been able to find. I have installed smail with no network and
> pine. It works fine but if I can't get some form of non-interative mail
> program I can't get the cgi script to work.
> 
> Anybody can tell me of the equivalent of /usr/bin/mail for Debian ??

Install "mailx" package for simple non-interactive mailer.
It contains /usr/bin/mail binary you are looking for.

Alex Y.

-- 
   _ 
 _( )_
( (o___   +---+
 |  _ 7   |Alexander Yukhimets|
  \(")|   http://pages.nyu.edu/~aqy6633/  |
  / \ \   +---+


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Mail command

1997-09-18 Thread G. Kapetanios

Hi,

As I am on a university network I have no right to send mail on my
machine. So I haven't installed any mail software until now. However, I
have set up my web page with stuff for downloading and a form. I would
like to have the cgi script to send an internal mail to a user on my
machine , no mail messages will be leaving the machine. Thw script
requires the binary /usr/bin/mail , the standard mail program, or
equivalent,  which I
haven't been able to find. I have installed smail with no network and
pine. It works fine but if I can't get some form of non-interative mail
program I can't get the cgi script to work.

Anybody can tell me of the equivalent of /usr/bin/mail for Debian ??

Thanks
George 


---
George Kapetanios
Churchill College
Cambridge, CB3 0DSE-Mail: [EMAIL PROTECTED]
U.K.  WWW: http://garfield.chu.cam.ac.uk/~gk205/work_info.html
---



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .