Quick Search for:  in language:    
script,receiving,mail,immediately,replying
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Perl Stats

 Code: 74,273. lines
 Jobs: 25. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for Perl
Click here to see a screenshot of this code!Mailing List v2.0
By Aaron L. Anderson on 1/7

(Screen Shot)

ShowIMG
By Jeff Mills on 1/5


Simple Perl Ping
By John Hass on 12/29


Very basic login script template with cookies
By Aaron L. Anderson on 12/29


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

Autoresponder

Print
Email
 
VB icon
Submitted on: 7/30/2000 12:45:04 AM
By: Found on the World Wide Web 
Level: Intermediate
User Rating: By 3 Users
Compatibility:5.0 (all versions), 4.0 (all versions), 3.0 (all versions), Pre 3.0

Users have accessed this code 10159 times.
 
 
     A script for receiving a mail and immediately replying
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    =**************************************
    = Name: Autoresponder
    = Description:A script for receiving a m
    =     ail and immediately replying
    = By: Found on the World Wide Web
    =**************************************
    
    #!/usr/bin/perl
    =pod
    =head1 NAME
    autoresponder - A scrtipt for receiving a mail and immediately replying.
    =head1 SYNOPSIS
    autoresponder [options] [filename]
    =head1 DESCRIPTION
    While installing a new mail server or client you typically are sending
    and receiving test mails over and over again. Even worse, you sometimes
    have to do a phonecall and ask someone for sending a mail to you.
    This script will help you in some cases by setting up an email address
    like autoresponder@company.com that will receive email addresses and
    immediately reply it back.
    =head1 INSTALLATION
    Install the prerequisite Perl modules, in particular Graham Barr's
    excellent Mailtools package. L<Mail::Internet(3)>.
    In /etc/mail/aliases or /etc/aliases, put lines like this:
    	autoresponder:	"| /usr/local/bin/autoresponder"
    	owner-autoresponder:	/dev/null
    	autoresponder-owner:	/dev/null
    Then do a "newaliases".
    Edit the autoresponder script and change the reply-to address to
    point back to one of the owner addresses. This should have the
    advantage that you won't see error messages generated by the
    autoresponder.
    =head1 SCRIPT CATEGORIES
    mailstuff
    =head1 PREREQUISITES
    The MailTools package, in particular the Mail::Internet module.
    L<Mail::Internet(3)>.
    =head1 OSNAMES
    any OS using sendmail or a compatible mail server
    =head1 AUTHOR
    	Jochen Wiedmann
    	Am Eisteich 9
    	72555 Metzingen
    	Germany
    	Email: joe@ispsoft.de
    =head1 SEE ALSO
    L<Mail::Internet(3)>, L<aliases(5)>
    =cut
    use strict;
    ############################################################################
    #
    #Configurable section
    #
    ############################################################################
    my $REPLY_TO = 'autoresponder-owner@neckar-alb.de';
    #
    #Use an entry like
    #
    #	autoresponder-owner:	/dev/null
    #
    #to suppress error messages from autoresponders replies.
    #
    ############################################################################
    use Mail::Internet ();
    use Getopt::Long ();
    use vars qw($opt_debug $opt_verbose $opt_help);
    sub Usage() {
    print <<EOF;
    Usage: autoResponder [options] [filename]
    Reads an email from [filename] (default: stdin) and replies to the sender.
    Possible options are:
    --debug Turn on debugging mode. (Suppresses actions)
    --help Print this help message.
    --verboseTurn on verbose mode.
    EOF
    exit 1;
    }
    eval { Getopt::Long::GetOptions('debug', 'verbose', 'help') };
    Usage() if $@ || $opt_help;
    $opt_verbose = 1 if $opt_debug;
    my $fh;
    if (@ARGV) {
    my $file = shift @ARGV;
    open(FILE, "<$file") or die "Failed to open $file: $!";
    $fh = \*FILE;
    print "Reading mail from $file.\n" if $opt_verbose;
    } else {
    $fh = \*STDIN;
    print "Reading mail from STDIN.\n" if $opt_verbose;
    }
    my $msg = Mail::Internet->new($fh, 'Modify' => 0, 'MailFrom' => 'KEEP');
    my @headers = @{$msg->head()->header()};
    my @body = @{$msg->body()};
    my @message = ("\n",
    	"Your mail was received by the autoresponder.\n",
    	"\n",
    	"Your headers have been:\n",
    	@headers,
    	"End of headers\n",
    	"\n",
    	"Your body follows:\n",
    	@body
    	);
    $msg = $msg->reply();
    $msg->body(\@message);
    print("Replying to $REPLY_TO.\n") if $opt_verbose;
    $msg->head()->replace('Reply-To', $REPLY_TO);
    print("Replying message:\n", $msg->as_string()) if $opt_verbose;
    $msg->smtpsend() unless $opt_debug;


Other 103 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
7/21/2003 4:47:29 AM:Phoenix Software
This is a gem.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Perl Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.