phplist/Sendmail/FreeBSD: X-Authentication-Warning

If you enable the $message_envelope variable in the config.php file of phplist for processing bounces, sendmail will probably complain with the following header in your email:
X-Authentication-Warning: your.domain.com: httpd set sender to account@domain.com using -f
This is because only “trusted users” are allowed to change the message envelope. By default, sendmail only considers root, daemon, and uucp as trusted users, so if you try changing the message envelope as the user Apache is running under (in my case httpd) sendmail will attach that nasty warning header to all your outgoing mails. Spam blockers don’t like this!

There are a couple of ways to fix this:

  1. Add httpd (or whatever user Apache is running under) to the daemon group:
    pw groupmod daemon -M httpd
  2. Add httpd (or whatever user Apache is running under) to Sendmail’s trusted-users file. Open up /etc/mail/your.domain.com.submit.mc in vi and insert the following line:
    FEATURE(`use_ct_file') dnl # Trusted users
    Save & Exit.
    Now you must create the trusted-users file in /etc/mail:
    touch /etc/mail/trusted-users
    Open /etc/mail/trusted-users with vi and on one line simply add the name of the user under which Apache is running:
    httpd
    Save & Exit. Run the following commands in /etc/mail to commit the changes to Sendmail and restart the server:
    make install
    make restart

That’s it, you should be good to go. Mail sent via PHP/Apache will no longer contain the X-Authentication-Warning header.

Note that there is a downside to this. Any user on your system can now use PHP to send email with “forged” headers. You basically just gave everyone on your system “Trusted User” status to Sendmail, so be sure that you trust your users before actually doing this!

UPDATE: How to do the same in Linux

phplist: Command not found / Bad interpreter

When using the script “phplist” to process queues or bounces on your phplist installation, you may receive the following error:
./phplist: Command not found.
This is caused by the file being in the wrong fileformat. You probably edited it on your Windows/Mac machine, uploaded it, and attempted to execute it. In order for this to work, the file must be in UNIX file format. To fix, open the file with vi (“vi phplist“) and type the following command:
: set ff=unix
Save, and exit, and your phplist should work as expected.

If you get the following error:
/bin/bash: bad interpreter: No such file or directory
That is because you either don’t have bash installed, or if you do, it’s in a different location. The first line of the phplist script (“#!/bin/bash“) must point to where your bash is installed. Find it with “whereis bash” or “find / -name bash“, edit the first line of the phplist script to match, and you should be good to go.

libpng on FreeBSD: “ld: invalid BFD target”

Ran into a little problem installing libpng 1.2.8 on FreeBSD 5.4. Running make gives the following:
ld -b +s +h libpng12.sl.0 -o libpng12.sl.0.1.2.8 png.pic.o pngset.pic.o pngget.pic.o pngrutil.pic.o pngtrans.pic.o pngwutil.pic.o pngread.pic.o pngrio.pic.o pngwio.pic.o pngwrite.pic.o pngrtran.pic.o pngwtran.pic.o pngmem.pic.o pngerror.pic.o pngpread.pic.o
ld: invalid BFD target `+s'
*** Error code 1Stop in /usr/src/libpng-1.2.8-config.

I found out that there is a typo in the INSTALL file that tells you to use the wrong makefile. It tells you to cp scripts/makefile.hpgcc makefile when in fact you should cp scripts/makefile.freebsd makefile. Using the correct makefile, of course, make works as expected!