webadept#! /usr/bin/perl -w use strict; use File::Spec; use Mail::MboxParser; use DBI; my $dbh = DBI->connect('DBI:mysql:blessing:webadept.net', 'yourusername', 'yourpassword', undef); chdir("/var/spool/mail"); my $mail = File::Spec->catfile('blessing'); my $mb = Mail::MboxParser->new($mail); my @a = $mb->get_messages; my $mailbox = 'blessing'; open(IN,">$mailbox"); close(IN); foreach my $msg(@a) {< my $subject = $msg->header->{subject}; my $from = $msg->header->{from}; my $body = $msg->body->as_string; $body=$dbh->quote($body); $from=$dbh->quote($from); $subject = $dbh->quote($subject); my $q = qq`insert into blessings values( '', $subject, $body, current_date, $from, 1, '') `; my $sth2 = $dbh->prepare($q); $sth2->execute() || die "Failed on update : \n$q\n\n"; } #foreach message loop ends $dbh->disconnect;
--if its not fun, its not worth it --
Edit kudra, 2002-02-26 Replaced BR with CODE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mail Poster For website pages
by shotgunefx (Parson) on Feb 26, 2002 at 10:33 UTC | |
|
•Re: Mail Poster For website pages
by merlyn (Sage) on Feb 26, 2002 at 15:13 UTC | |
by VSarkiss (Monsignor) on Feb 26, 2002 at 16:04 UTC | |
by shotgunefx (Parson) on Feb 26, 2002 at 19:05 UTC | |
|
Re: Mail Poster For website pages
by webadept (Pilgrim) on Feb 26, 2002 at 16:34 UTC | |
|
Re: Mail Poster For website pages
by baku (Scribe) on Mar 08, 2002 at 18:09 UTC | |
|
Re: Mail Poster For website pages
by hsweet (Pilgrim) on Mar 19, 2002 at 03:13 UTC |