#!/usr/bin/perl # # from.pm - 12/29/96 by David Efflandt # # If your Linux is missing the 'from' command, here is a perl # substitute. It tells you who incoming mail is "from". # # - cp this to your path as 'from' (/usr/local/bin?). # - 'chmod 755 from' (so anyone can use it) # No parameters (uses your login name). # # If you want to bring pop3 mail into your local mailbox # look for 'fetchmail' (update of 'popclient'). # $login = getlogin || (getpwuid($<))[0] || "unknown_user"; $file = "/var/spool/mail/$login"; -s $file || die "no mail for $login\n"; open(IN,"<$file") || die "Can't open mail: $!\n"; while() { # delete "?" below if using perl4 print if /^From \S+?\@/; } close IN;