cannot send email from perl

Status
Not open for further replies.

ldsdates

New Member
Messages
6
Reaction score
0
Points
0
Cannot send mail from perl any longer after recent system upgrades on chopin
Error message: sendmail: sendmail cannot be called directly from a shell with the current user id

Example script:
open (MAIL, "| /usr/sbin/sendmail -t");
print MAIL "To: $mailto\n";
print MAIL "From: $sendmailfrom\n";
print MAIL "Subject: $subject\n";
...
The scripts were working on x10hosting before system updates were perfomed in early june. The scripts work on other hosting platforms. This was submitted before and no solution was provided, the thread created in the forums does not have a solution and has been closed.

---------- Post added at 05:32 PM ---------- Previous post was at 05:23 PM ----------

This script works on other hosting providers, it also used to work on x10 hosting before system updates were performed by x10 in early june.

Does anyone have a solution?
 

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
What type of email script is it?
 

dlukin

New Member
Messages
427
Reaction score
25
Points
0
How is the script called?
I can get Perl-sendmail to work as a cron job but it dies silently when I try to use it in a web script (Apache runs as nobody, and I think their mail server filters out the mails sent this way since it is not from an account attached to a domain ... cron jobs run as me, so they go through ).

I don't know how you get that error. Do you call the Perl script from another script?
 

ldsdates

New Member
Messages
6
Reaction score
0
Points
0
I use it as a subroutine and call if from the main script as shown here:

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
use CGI qw:)standard);
...
# validate login and get account information
...
$mailto="...@...com";
&sendnotification;
...
exit;

sub sendnotification{
$subject='Account Active';
$sendmailfrom='accounts@mywebsite.com';
open (MAIL, "| /usr/sbin/sendmail -t");
print MAIL "To: $mailto\n";
print MAIL "From: $sendmailfrom\n";
print MAIL "Subject: $subject\n";
print MAIL "Return-Path: $sendmailfrom\n\n";
print MAIL "Content-Type: text/plain; charset=us-ascii\n\n";
print MAIL "$mailto,\n\nYour account is now active, blah blah blah...\n\n";
close (MAIL);
}
 
Status
Not open for further replies.
Top