×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can't Sendmail....

Can't Sendmail....

Can't Sendmail....

(OP)
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 "From: \<form submit\>\n";
 print MAIL "Subject: HI there\n";
 print MAIL "Mime-Version: 1.0\n";
 print MAIL "X-Mailer: Limestone Mailer v1.0\n";
 print MAIL "Content-Type: text/plain;\n\n";
 print MAIL "This is the body.\n";
 close(MAIL);
}


##########################
# Returns an HTML document
sub ret_html {
  print "Content-type: text/html\n\n";
  print "<html>\n";
  print "<head>\n";
  print " <title>Mail</title>\n";
  print " <link href=\"stylesheet.css\" type=\"text/css\" rel=\"stylesheet\">\n";
  print "</head>\n";
  print "<body bgcolor=\"#000000\">\n";
  print "Mail has been sent\n";
  print "</body>\n";
  print "</html>\n";
}

RE: Can't Sendmail....

well, one thing that would really kill the mail sending portion of the script is if you dont have sendmail...

adam@aauser.com

RE: Can't Sendmail....

(OP)
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

RE: Can't Sendmail....

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,"|$mail_prog -t") || die "$!";

run it from the command line, and see what the error is.

adam@aauser.com

RE: Can't Sendmail....

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.
http://www.oac-design.com

RE: Can't Sendmail....

wow, that was very observant, i completely missed those.

adam@aauser.com

RE: Can't Sendmail....

(OP)
THANKS!

it works....

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close