Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: email submission

by kilinrax (Deacon)
on Nov 24, 2000 at 17:56 UTC ( #43213=note: print w/replies, xml ) Need Help??

in reply to email submission

Check that 'www-data' (or whichever user is sending the mail) is allowed by your MTA to set the 'From:' field. For instance, if you're using exim, add the user name to the 'trusted users' field of '/etc/exim.conf', e.g:
trusted_users = mail:www-data
If you're not using exim, then I'm sorry I can't be more help, but there will probably be a similar configuration option somewhere, which I'd guess should be covered in the documentation of whatever you're using ;-)

Update: Thought you might find the following code useful to check yours against or even adapt to your purposes ;-)
#!/usr/bin/perl -w use strict; use Mail::Mailer; use Getopt::Std; use vars qw( %opts $line $user $body ); getopts('f:t:s:h', \%opts); $user = getpwuid($<); sub usage() { print <<EOF; Usage: $0 [options] Example: $0 -t root\ -f die.puny\ -s \'Your + comic is the wierdest thing _ever_\' Synopsis: sends mail to the specified address -h : displays this help screen -t ADDRESS : address to mail to -f ADDRESS : address to mail from (default is your user name: \'$user\ +') -s SUBJECT : subject of the mail If no flags are given, then the first argument given is assumed to be +the address to mail to, or if no options are given, this help screen +is displayed. EOF exit; } if ($opts{'h'}) { usage(); } if (!$opts{'t'}) { if ($ARGV[0]) { $opts{'t'} = $ARGV[0]; } else { die "You must enter an address to mail to. See $0 -h for help on u +sage."; } } if (!$opts{'f'}) { $opts{'f'} = $user; } if (!$opts{'s'}) { $opts{'s'} = 'No subject'; } print "Enter body of message, use a single \'.\' on a line to finish.\ +n"; while ($line = <STDIN>) { last if ($line =~ /^\.$/); $body .= $line; } sendmail ($opts{'f'}, $opts{'t'}, $opts{'s'}, $body); print "Mail Sent.\n"; exit; sub sendmail { my ($from, $to, $subject, $body) = @_; my $mailer; eval { $mailer = Mail::Mailer->new('sendmail'); }; if ($@) { warn "Couldn't send mail: $@"; } else { $mailer->open({ To => $to, From => $from, Subject => $subject }); print $mailer $body; unless (close ($mailer)) { warn "Couldn't close mailer: $!"; } } }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://43213]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-05-29 09:35 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (101 votes). Check out past polls.