# sendmail and mailing



## yom (Jan 8, 2013)

Hello,

I'm using `sendmail` at my work to send mails to some users (a lot), and I'm using the -f flag to change the "from" in the header.

Though I can read this in the sendmail manual :


```
-fname Sets  the name of the ``from'' person (i.e., the envelope sender
              of the mail).  This address may also be used in the From: header
              if  that header is missing during initial submission.  The enve-
              lope sender address is used as the recipient for delivery status
              notifications  and may also appear in a Return-Path: header.  -f
              should only be used by ``trusted'' users (normally root, daemon,
              and  network)  or  if the person you are trying to become is the
              same as the person you  are.   Otherwise,  an  X-Authentication-
              Warning header will be added to the message.
```

I'm thinking about adding the user executing the sendmail command to one of these groups : daemon or network, so that the *X-Authentication-Warning* header won't be appended to each mail.
But since they are system groups, I'm not really sure about the best choice I've got. One or the other, or maybe another best practice ?

Help would be really appreciated.


----------



## SirDice (Jan 8, 2013)

I suggest using a mailinglist manager like mail/mailman or mail/majordomo.


----------



## kjpetrie (Mar 8, 2013)

I have the same problem. In my case it's www which generates the messages from PHP and I'm using the -f option to set the From: header without generating an Envelope From.

I have created an /etc/mail/trusted-users (mode 640, owned by root:wheel) file containing just the line *www* I've tried both with and without a newline at the end) and I have added 
	
	



```
FEATURE(`use_ct_file')
```
 as the penultimate line of /etc/mail/<domain>.submit.mc and run `# m4` to generate an uncommented 
	
	



```
Ft/etc/mail/trusted-users
```
 in my /etc/mail/<domain>.submit.cf, but still I have an *X-Authentication-Warning* header revealing the www user name.

Obviously, I and the original poster have missed something here and something else is needed, but I can't see what it is.

Any help would be most welcome.


----------



## kjpetrie (Mar 9, 2013)

OK, I've finally solved it for myself.

It seems I misunderstood the instruction to run `# m4`. I was redirecting the output from running it on /etc/mail/<domain>.submit.mc to /etc/mail/<domain>.submit.cf instead of to submit.cf. Once I did that it worked.

Incidentally, unless you're likely to change the list of trusted users frequently, setting up a trusted-users is a bit much. To add a single new trusted user just add 
	
	



```
define(`confTRUSTED_USERS', `<user>')dnl
```
 to <domain>.submit.mc where <user> (without the angle brackets) is the name of the user. Then generate a new submit.cf with `# m4`

Yom, adding the user to a group won't work because these are trusted users, not trusted groups.

When I say submit.cf I mean /etc/mail/submit.cf just in case it wasn't clear.


----------

