×
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

sendmail module in LINUX

sendmail module in LINUX

sendmail module in LINUX

(OP)
I am new  to  Perl working  on LINUX Redhat 6.0 platform.
All  the  sample  codes for  sending a  simple  mail mention of the 'sendmail' module located  at /usr/lib/sendmail    or /usr/sbin/sendmail.

I am not  aware whether  we  need  to  configure  the sendmail   module  which comes with  the LINUX (or  Unix  for  that  matter)  for  sending  email .

Can  someone aware  of  this  kindly  advice ??

The sample  code I  have  used is shown as a crosscheck.


#!/usr/bin/perl
use CGI;

my $query    = new CGI;
my $sendmail = "/usr/sbin/sendmail -t";  #=> path  of      #sendmail  module  in  My LINUX  Redhat.

my $reply_to = "Reply-to: foo@bar.org";
my $subject  = "Subject: Confirmation of your submission";
my $content  = "Thanks for your submission.";
my $to       = $query->param('send_to');
my $file     = "subscribers.txt";

unless ($to) {
  print $query->header;
  print "Please fill in your email and try again";
}

open (FILE, ">>$file") or die "Cannot open $file: $!";
print $to,"\n";
close(FILE);

my $send_to  = "To: ".$query->param('send_to');

open(SENDMAIL, "¦$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);

print $query->header;
print "Confirmation of your submission will be emailed to you.";
    

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