Loading ...
Sorry, an error occurred while loading the content.

Newbie: Problems with Command Line Vars

Expand Messages
  • Keith Wilson
    I am a little new here, been looking at perl for about a month, but I ... #!/usr/bin/perl -w use MIME::Lite; $msg = MIME::Lite- new( From =
    Message 1 of 1 , Oct 30, 2002
    • 0 Attachment
      I am a little new here, been looking at perl for about a month, but I
      cannot seem to find the problem with the following code:
      ------8<--------
      #!/usr/bin/perl -w

      use MIME::Lite;

      $msg = MIME::Lite->new(

      From => 'webbot@...',
      To => ' $ARGV[0] ',
      Subject => '[ gdMySQLBackup ] - $ARGV[1] backup has Finished',
      Type => 'text/plain',
      Data => "Enclosed is a recent copy of your database $ARGV[1].");

      $msg->attach(Type=>'application/x-tar',
      Path =>"sqldata/$ARGV[1]",
      Filename =>"$ARGV[1]");

      $msg->send;

      print "Data file $ARGV[1] sent to $ARGV[0]\n";
      ------8<--------
      It seems to be complaining about the ARGV[0] in the To => line. The
      email bounces as it is looking to mail the user with the name ARGV[0]

      But later on in the print line at the bottom, it resolves the
      variable correctly...

      $ARGV[0]... User unknown
      Data file dbkeithism.sql sent to keith@...

      Heeellllp!
    Your message has been successfully submitted and would be delivered to recipients shortly.