![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rsh permission denied | lweegp | Shell Programming and Scripting | 7 | 09-15-2006 01:36 AM |
| Permission Denied | howeezy | UNIX for Dummies Questions & Answers | 0 | 09-14-2005 06:52 AM |
| ./ Permission Denied. | trouscaillon | UNIX for Dummies Questions & Answers | 8 | 01-26-2005 06:33 PM |
| rcp 'permission denied' | Kevin Pryke | UNIX for Dummies Questions & Answers | 6 | 04-24-2002 01:20 AM |
| rsh and permission denied | Reza Nazarian | UNIX for Dummies Questions & Answers | 1 | 10-15-2001 09:21 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Perl: Sendmail - Permission denied
Hi,
I'm trying to write a simple mail handler perl script for a website I'm working on. I've managed to installed sendmail yesterday, and I'm currently trying to get the script to work. I'm getting an error however. Here's the block of perl code I'm using: Code:
open(MAIL, "| $sendmailpath -t") || print "Error Opening mail: $!"; print MAIL "To: my\@e-mail.com"; print MAIL "Reply: $sender_mail"; print MAIL "Subject: $sender_subj"; print MAIL "\n"; print MAIL "$sender_msg"; close MAIL || print "Error Closing mail: $!"; I'm assuming it's a user/group/permission problem, since the sendmail program is being run by the webscript. However, this is my first time working with sendmail, and I have no idea what the correct settings should be. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Hi,
Chance is you might already have this package Net::SMTP - perldoc.perl.org try it, its the same as yours but avoid invoking sendmail binary directly IMHO. Anyway you can download it on Net::SMTP - Simple Mail Transfer Protocol Client - search.cpan.org |
|
#3
|
|||
|
|||
|
So what's in $sendmailpath?
|
|
#4
|
|||
|
|||
|
The $sendmailpath contains /usr/sbin/sendmail.
When using Net::SMTP I need to connect to an SMTP server though correct? I'm trying to avoid this here. |
|
#5
|
||||
|
||||
|
Thats correct, but /usr/sbin/sendmail will talk to a SMTP server as well unless the recipient is on your localhost. And if its on another host then you defenitly need to speak to a smtp server, your mail gateway, (either with /usr/bin/sendmail or any other client Net::SMTP) that will deliver that mail to the recipient...
|
|
#6
|
|||
|
|||
|
Alright, perhaps I should try to send it through my ISP's smtp server. I'm running this webform on my own home system. But, don't I have to enter a login and password for the smtp server? how would I do that with Net::SMTP?
|
|
#7
|
||||
|
||||
|
Nope, you're not required to use authentication to send mail only retreiving would ... and you even wont need you're ISP mail gateway.
Here's a sample code: Code:
#!/usr/bin/perl -w
use Net::SMTP;
$smtp = Net::SMTP->new("recipent.server.com",Hello => 'yourdomain.com');
$smtp->mail("fromyou@yourdomain.com");
$smtp->to("user1@server.com");
$smtp->cc("foo@server.com");
$smtp->data;
$smtp->datasend("From: fromyou\@yourdomain.com");
$smtp->datasend("To: user1\@server.com");
$smtp->datasend("Subject: This is a test");
$smtp->datasend("\n");
$smtp->datasend("Body Of The Mail");
$smtp->dataend;
$smtp->quit;
|
||||
| Google The UNIX and Linux Forums |