PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:
Good Afternoon my fellow monks here is my question: I have a variable that is passed from one subroutine to another. In the second subroutine this variable could represent one or more values. What I am trying to accomplish is sending an email based on an Abbreviation for example: $emailverify in the previous sub could equal Bob, Tim, George etc. In a database Bob = some@email.com, Tim = test@cork.com etc. I am having trouble making $emailverify = Bob in turn making Bob = $to and sending the file to Bob or Tim. Thanks in advance!
sub email { my $emailverify = shift; print ("(1) MICROSOFT ACCESS"); my $input = <STDIN>; $input = <STDIN> until defined $input; chop ($input); if ( $input == 1 ) { # SENDS MS ACCESS FILE my $from = 'email@system.com; my $your_file = 'file.mdb'; my $my_file = 'file.mdb'; my $mime_type = 'multipart/mixed'; my $mail_server = 'mail.test.com'; my $to = $emailverify; my $msgone = "Dear $emailverify Your Files are Attached"; # CREATE MESSAGE my $msg = MIME::Lite->new( From => $from, To => $to, Type => $mime_type, Subject => 'Files Attached', ); # CREATE ATTACHMENT $msg->attach( Type => 'TEXT', Data => "$msgone" ); $msg->attach ( Type => 'application/msaccess', Path => $my_file, Filename => $your_file, Disposition => 'attachment' ) or die "Error adding $your_file: $!\n"; MIME::Lite->send('smtp', $mail_server, Timeout=>60); $msg->send or die "Couldn't Send $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Single variable Multiple Values
by Perlbotics (Archbishop) on Jun 29, 2013 at 18:11 UTC | |
by PilotinControl (Pilgrim) on Jun 30, 2013 at 22:25 UTC | |
|
Re: Single variable Multiple Values
by Happy-the-monk (Canon) on Jun 29, 2013 at 18:10 UTC | |
|
Re: Single variable Multiple Values
by poj (Abbot) on Jun 29, 2013 at 19:17 UTC | |
|
Re: Single variable Multiple Values
by Anonymous Monk on Jun 30, 2013 at 05:16 UTC |