# mailx permission denied

## kai.scorpio

Hi all, I am trying to send an automated email using mailx, however when testing it I get this error:

```
Jan 22 15:51:19 kai-gentoobase sendmail[14832]: q0MEpJwj014832: from=kai, size=53, class=0, nrcpts=1, msgid=<201201221451.q0MEpJwj014832@kai-gentoobase.speedport.ip>, relay=root@localhost

Jan 22 15:51:19 kai-gentoobase sm-mta[14833]: q0MEpJ0t014833: SYSERR(root): collect: Cannot write ./dfq0MEpJ0t014833 (bfcommit, uid=0, gid=209): Permission denied

Jan 22 15:51:19 kai-gentoobase sm-mta[14833]: q0MEpJ0t014833: from=<kai@kai-gentoobase.speedport.ip>, size=374, class=0, nrcpts=1, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]

Jan 22 15:51:19 kai-gentoobase sendmail[14832]: q0MEpJwj014832: to=[DESTADDR], ctladdr=kai (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30053, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfq0MEpJ0t014833 (bfcommit, uid=0, gid=209): Permission denied
```

I am not sure what is going on here - most tutorials for mailx don't mention any necessary setup of sendmail/mailx, so perhaps I've just missed a step. The part confusing me is the "permission denied" even when running as root. Thanks for any help!

Kai

----------

## Bones McCracker

Doesn't look like a mailx problem to me.  Looks like a sendmail problem.

But I can't help you with that, since I don't use sendmail.  You probably need to put sendmail in your subject line.  I suspect you have sendmail improperly configured.

Sendmail is a great thing, but it's complex and uses a somewhat arcane configuration format.  Unless you're actually intending to operate a mail server (rather than to just be able to send mail from the system), you probably don't need it.  You can probably use something like ssmtp, nbsmtp, or esmpt, etc. (light, "relay only" or "send only" MTAs).

There is a lot of information out there about configuring sendmail.  If you don't need a full-blown mail server, you an also find information about configuring ssmtp and other tools like it.

Also, if you're only sending automated messages, you probably don't even need mailx.  You can send mail directly using sendmail (and many programs, such as cron, do so).  To see how, check the sendmail man page.  As I recall, there are a few packages that require mailx, though (such as smartmontools, if you done use USE="minimal").  Also, mailx may be easier to work with for scripting (I don't know).

I was putting mailx on my systems for years, along with a light mta (I use esmtp, because it can do local delivery as well as sending mail out to an SMTP server for relay), and I did use mailx to test the mail system.  But eventually I figured out that it wasn't actually being used by anything and had nothing depending upon it, so I got rid of it.  Your situation may be entirely different (i.e., you may be hosting mailboxes for multiple people and need a full-blown mail server).

----------

## kai.scorpio

Ah, you're probably right, that's just the first set of packages I came across. I'll try the others and see if they work.

If anybody knows how to fix this, post here anyway  :Smile: 

Kai

----------

## trigggl

Since this is the first post that Google brings up for the search, I think it's important to answer the question.

https://forums.gentoo.org/viewtopic-p-6748182.html#6748182

Apparently the ownership of /var/spool/mqueue needs to be root, or at least that fixed the problem for me.  It was owned by smmsp.

----------

