db2admin has asked for the wisdom of the Perl Monks concerning the following question:

Recently CIHOST.com has run into problems with AOL whereby AOL started rejecting e-mail from any of CIHOST's network (propagation.net). There now seems to be an agreement between the two that as long as some rules are followed mail can be accepted by AOL. One of those rules is that scripts, such as with perl, cannot use the user "nobody" to send e-mails to AOL users.

The question I have is how can I configure my script to use a user other than "nobody"?
When I send an e-mail using MIME::LITE or Mail::Mailer, my maillog shows the two e-mail addresses that were sent, one to AOL user and one to a Yahoo user. The AOL e-mail never gets to its destination but I never see an error in my spooler. The Yahoo e-mail gets to the user successfully.

Oct 29 21:43:37 xxxxxx sendmail[24352]: i9U2hb924350: to=someuser@aol. +com, ctladdr=nobody (99/99), delay=00:00:00, xdelay=00:00:00, mailer= +relay, pri=98308, relay=mail.mx2.propagation.net. [63.249.128.130], d +sn=2.0.0, stat=Sent (Ok: queued as 8DDA7AFBC8) Oct 29 21:43:48 xxxxxx sendmail[24352]: i9U2hb924350: to=someuser@yaho +o.com, ctladdr=nobody (99/99), delay=00:00:11, xdelay=00:00:11, maile +r=esmtp, pri=98308, relay=mx3.mail.yahoo.com. [64.156.215.7], dsn=2.0 +.0, stat=Sent (ok dirdel 2/0)
Here is the snippet from my Perl program:

my $msg = MIME::Lite->new( To => 'someuser@aol.com', From => 'admin@server.com', Subject =>'some subject', Type =>'multipart/related' ); $msg->attach(Type => 'text/html', Data => qq{ (html goes here) } ); $msg->send();
FYI, sendmail from the command line to an AOL user does work when I am logged on as root or another user.

Replies are listed 'Best First'.
Re: Using "nobody" to send e-mail
by tachyon (Chancellor) on Oct 30, 2004 at 05:22 UTC

    Sendmail runs suid so if your webserver is running as nobody it will send the mail as that user. There are several options. First we are assuming that it is the real issue as there are other possibilities.

    You could simply run the webserver as another user like 'somebody' for example. The changes required should be fairly minimal. Just change this in /etc/httpd/conf/httpd.conf

    User somedoby Group somebody

    You may or may not need to fix some perms on your webdirs to keep it happy.

    Another approach is to change the name string associated with user nobody which will retain the nobody UID/GID so you don't get perms issues. You could do it by editing /etc/passwd /etc/shadow /etc/group. Unfortunately anything else looking for user nobody will now be out of luck so don't do that.

    You could look at bypassing sendmail and using Net::SMTP to send the mail. MIME::Lite will happily use it.

    Finally you can fool around with the /etc/sendmail.cf. See this article and setting U=/DefaultUser/RunAsUser.

    cheers

    tachyon

      Wouldn't delegating sending the message to a setuid script or another user's cron job work too? Either should be extremely easy to write and have no impact on anything else in the system.
Re: Using "nobody" to send e-mail
by atcroft (Abbot) on Oct 30, 2004 at 05:02 UTC

    I do not know if this may be the case or not, but check the headers of the email for the Return-Path header, and also compare the headers when sent from 'nobody' and from a user on the system. Doing so may give you more insight as to the particular portion being seen (and rejected) by their mail server.

    Hope that helps.