-
Who knows what spam is?
-
You could use Perl to parse a file of e-mail addresses, and send an e-mail
to each of those addresses.
-
Put each e-mail in an array, then loop through the array and send an e-mail
to each array element.
-
But there are some better uses.
-
E-mail a confirmation to people who signed up for something (like class).
-
E-mail an administrator when content is posted on a website.
-
A good way to monitor dirty words and the like.
-
You already know a lot about this.
-
Generating an e-mail is just like writing to a file. Just a few differences.
-
Use a normal filehandle, in place of a filename, type this: "|/usr/sbin/sendmail
-t"
-
This "pipes" the contents to sendmail, the e-mail program on oz.
-
Put the to address on a line starting with To: and ending with \n, the
newline special characters. Do the same with From and Subject. Then
print the body. See source below.
-
Make sure you escape out characters like @, if necessary.
-
Close it, just like you would any file.
$contents = "This is in the body of the e-mail.";
# Open a filehandle, MAIL, and "pipe" it to our sendmail program
at UC.
# Copy this same syntax if you wish to generate an e-mail.
# Note that the sendmail program interprets the special lines To:,
From:, and Subject: appropriately.
# The $contents scalar writes to the body of the e-mail.
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: jonesbl\@one.net\n $email\n";
print MAIL "From: $email\n";
print MAIL "Subject: $bearcatID\n";
print MAIL "$contents\n";
close(MAIL);