Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Sending Bulk E-mails - Page 10

August 29, 2001

The last thing we need to do is send off the e-mails to all the customers. We can reuse a slightly modified version of an earlier script using the Mail::Send module.

use Mail::Send;
open(CSV,"newlist.txt") or die "Cannot open newlist.txt for read\n";
open(MESSAGE,"message.txt") or die "Cannot open message.txt for read\n";
my $message = join ('',<MESSAGE>);

while (<CSV>) {
    my @list = split (/,/);
    s/^"|"$//g foreach @list;
    my $msg = new Mail::Send (To      => "$list[0] $list[1] <$list[2]>",
			      Subject => "Recall: faulty coupling");
    my $fh = $msg->open;
    print $fh $message;
    $fh->close;
}

Once the script has been run, each customer will receive the following e-mail message:

We regret to inform you that due to a faulty internal coupling in our new oscillation overthruster, you may experience anomalies during molecular reconstruction due to leaking matter. We highly recommend that you suspend operation of the drive until an operative can replace the faulty part. We wish you success in your travels to the eighth dimension and hope to see you soon on Planet 10.

Sincerely,

John Wharfin
Yoyodyne Propulsion Systems

Conclusion

We've learned quite a bit about processing text with Perl functions, how to utilize CSV files, and use array functions. In the next and final article in the series, we'll learn more about using pre-built Perl modules to make it even easier to perform complex text processing tasks.

Sorting and Searching for Duplicate Records - Page 9
Weaving Magic With Regular Expressions
Processing Text with Perl Modules - Page 11


Up to => Home / Authoring / Languages / Perl / Weave




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers