How can I send email attachment without using an additional library in Perl?

后端 未结 6 912
感情败类
感情败类 2021-01-15 06:49

Hey, I was wondering if there is a way to attach files (specifically .csv files) to a mail message in Perl without using MIME::Lite or any other libraries.

Right now

6条回答
  •  猫巷女王i
    2021-01-15 07:15

    print "To: ";       my $to=<>;      chomp $to;
    print "From: ";     my $from=<>;    chomp $from;
    print "Attach: ";   my $attach=<>;  chomp $attach;
    print "Subject: ";  my $subject=<>; chomp $subject;
    print "Message: ";  my $message=<>; chomp $message;
    
    my $mail_fh = \*MAIL;
    open $mail_fh, "|uuencode $attach $attach |mailx -m -s \"$subject\" -r $from $to";
    print $mail_fh $message;
    close($mail_fh);
    

提交回复
热议问题