You are not logged in.

#1 2010-12-20 21:18:30

djg1971
Member
Registered: 2008-09-11
Posts: 185

cannot send mail from script !?!? [SOLVED]

Today I learned that I cannot do the following using my arch-64 system:  eg.

#!/bin/bash
cat file.txt | mail -s test myself@someaddress

The reason?  Looks to be no /usr/sbin/sendmail binary.  There are several ways to deal with this:

1) install from AUR (comments say it doesn't actually work so I skipped trying this)

2) install postfix (tried it, doesn't cause above type approach (in script) to work.  at least not without more effort than I can spare right now.)

3) install mailx (but wait, it's already installed! ... reinstall... ok, but, still no mailx binary present on system...?)

mailx looks fine to me, only installing/reinstalling the package doesn't yield either sendmail or mailx binaries.

anyone know what I'm missing?

Last edited by djg1971 (2010-12-21 00:00:01)

Offline

#2 2010-12-20 21:53:38

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: cannot send mail from script !?!? [SOLVED]

set sendmail="/usr/bin/mailx"

in your /etc/nail.rc.

Edit: I'm using mailx-heirloom
https://bbs.archlinux.org/viewtopic.php … 48#p823748

Last edited by karol (2010-12-20 21:55:46)

Offline

#3 2010-12-20 22:42:15

djg1971
Member
Registered: 2008-09-11
Posts: 185

Re: cannot send mail from script !?!? [SOLVED]

well, tried what you suggested wrt /etc/nail.rc ...

now when I try, eg.:

echo blah | mailx -s test myself@address

I get:

1)  no dead letter
2)  no log file entry
3)  no message actually sent
4)  cpu maxed out, 3 or more mailx processes keep appearing and do not stop reappearing once killed.

okay... just had success with killing mailx processes (maybe 15th try).  but no log entries, no dead letter, and no message sent.

any more ideas?

Offline

#4 2010-12-20 23:22:31

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: cannot send mail from script !?!? [SOLVED]

I'm just using mailx-heirloom (from [Community]) with my gmail account:

[karol@black ~]$ cat /etc/nail.rc 
set sendmail="/usr/bin/mailx"

set smtp=smtp.gmail.com:587
set smtp-use-starttls
set ssl-verify=ignore
set ssl-auth=login
set smtp-auth-user=login@gmail.com
set smtp-auth-password=YOURPASS

Do you have it configured the same way?

Offline

#5 2010-12-20 23:59:30

djg1971
Member
Registered: 2008-09-11
Posts: 185

Re: cannot send mail from script !?!? [SOLVED]

okay...now I understand the mimimum to make it all work:

you only need to have "mailx" and "ssmtp" packages on your system.

then only need to edit the "mailhub=" line in /etc/ssmtp/ssmtp.conf and add an appropriate IP address after the = sign.

then something like:   cat  file.txt  |  mail -s "a subject"   you@somewhere   
will just work.

some of the packages pertaining to mail would seem to be confusingly labeled... hope this helps someone.

Offline

#6 2010-12-21 00:11:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: cannot send mail from script !?!? [SOLVED]

I've never used ssmtp so I don't know how to make it work - it's just mailx-heirloom for me.

Offline

Board footer

Powered by FluxBB