Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Sendmail....

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
My knowledge of perl is fairly limited. I'm trying to setup a mailing list for my friend's band. The part that is causing me problems is the actual sending of the mail. I cut out all of the other stuff, so all this script is supposed to do is send an e-mail and return html. Most of the code is just stuff that I have seen in other scripts which is why I am so confused as to why it isn't working. It displays the html, but I never get an e-mail.
Any ideas?
Thanks

#!/usr/local/bin/perl

###################
# Program Variables
$mail_prog = `/usr/bin/sendmail`;


###################
# Program Execution
&send_mail;
&ret_html;
exit;


#################
# Sends an e-mail
sub send_mail {
open(MAIL,"|$mail_prog -t");
print MAIL "To: dpfrey\@home.com\n";
print MAIL &quot;From: \<form submit\>\n&quot;;
print MAIL &quot;Subject: HI there\n&quot;;
print MAIL &quot;Mime-Version: 1.0\n&quot;;
print MAIL &quot;X-Mailer: Limestone Mailer v1.0\n&quot;;
print MAIL &quot;Content-Type: text/plain;\n\n&quot;;
print MAIL &quot;This is the body.\n&quot;;
close(MAIL);
}


##########################
# Returns an HTML document
sub ret_html {
print &quot;Content-type: text/html\n\n&quot;;
print &quot;<html>\n&quot;;
print &quot;<head>\n&quot;;
print &quot; <title>Mail</title>\n&quot;;
print &quot; <link href=\&quot;stylesheet.css\&quot; type=\&quot;text/css\&quot; rel=\&quot;stylesheet\&quot;>\n&quot;;
print &quot;</head>\n&quot;;
print &quot;<body bgcolor=\&quot;#000000\&quot;>\n&quot;;
print &quot;Mail has been sent\n&quot;;
print &quot;</body>\n&quot;;
print &quot;</html>\n&quot;;
}
 
well, one thing that would really kill the mail sending portion of the script is if you dont have sendmail...

adam@aauser.com
 
no, it's there 90% sure

and I tried the script somewhere else that I am 100% sure there is sendmail and it still didn't work
 
well, if sendmail is there, and configured properly, that should work... maybe you might want to check your path to sendmail.. mine is: /usr/lib/sendmail


and if all else fails, put a die in there:

open(MAIL,&quot;|$mail_prog -t&quot;) || die &quot;$!&quot;;

run it from the command line, and see what the error is.
adam@aauser.com
 
Are those backticks I see there in the variable definition of $mail_prog? That won't work with a piped open. You just want a plain string. Use double-quotes.

Here's a sendmail faq: faq219-364
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
wow, that was very observant, i completely missed those. adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top