I'm trying, for the first time, to use NET::SMTP instead of SENDMAIL. However, I'm getting frustrated with my efforts despite the accumulating beer bottles on my desk...
This is the script I've been working with:
This is what is in my error logs when I run this script:
[Thu Apr 08 15:04:55 2004] [error] [client 12.34.567.890] Premature end of script headers: testmail.cgi
[Thu Apr 08 15:04:55 2004] [error] [client 12.34.567.890] failed to open log file /var/log/httpd/suexec_log
[Thu Apr 08 15:04:55 2004] [error] [client 12.34.567.890] fopen: Permission denied
So then I tried this:
Still get the same error in the logs as above. It's been a long day and my eyeballs hurt. I'd really appreciate it if someone could give me a hint so I can attack it fresh in the morning.
Thanks so much!
Patrick
There's always a better way. The fun is trying to find it!
This is the script I've been working with:
Code:
#!usr/bin/perl -w
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Net::SMTP;
my $smtp_server = 'mail.mydomain.com';
my $smtp = Net::SMTP->new($smtp_server);
print "Content-type: text/html\n\n";
$smtp = Net::SMTP->new($smtp_server, Debug=>1);
$smtp->mail("info\@mydomain.com");
$smtp->to("fred\@frick.com");
$smtp->data();
$smtp->datasend("Hello!\n\n");
$smtp->dataend();
$smtp->quit();
This is what is in my error logs when I run this script:
[Thu Apr 08 15:04:55 2004] [error] [client 12.34.567.890] Premature end of script headers: testmail.cgi
[Thu Apr 08 15:04:55 2004] [error] [client 12.34.567.890] failed to open log file /var/log/httpd/suexec_log
[Thu Apr 08 15:04:55 2004] [error] [client 12.34.567.890] fopen: Permission denied
So then I tried this:
Code:
#!usr/bin/perl -w
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Net::SMTP;
use MIME::Base64;
my $smtp_server = 'mail.mydomain.com';
my $smtp = Net::SMTP->new($smtp_server);
my $user = "username";
my $pass = "password";
# One way
my $auth_string = encode_base64("$user\0$user\0$pass");$smtp->command('AUTH', 'PLAIN', $auth_string);
print "Content-type: text/html\n\n";
$smtp = Net::SMTP->new($smtp_server, Debug=>1);
$smtp->mail("info\@mydomain.com");
$smtp->to("fred\@frick.com");
$smtp->data();
$smtp->datasend("Hello!\n\n");
$smtp->dataend();
$smtp->quit();
Still get the same error in the logs as above. It's been a long day and my eyeballs hurt. I'd really appreciate it if someone could give me a hint so I can attack it fresh in the morning.
Thanks so much!
Patrick
There's always a better way. The fun is trying to find it!