- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Perl Scripting for mail handling
Operating System - Linux
1753615
Members
5946
Online
108797
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2006 02:26 PM
тАО09-07-2006 02:26 PM
Hi guys,
I am relatively new to perl, am trying to write some stuff... can someone roughly explain each line do?:
#!/usr/bin/perl
use strict;
use Mail::POP3Client;
#---------------------------------------------------------
#
#
sub clear_mail
{
my $pop;
my $n;
my $i;
my $test_text;
my $user;
my $passwd;
my $server;
$server = $_[0];
$user = $_[1];
$passwd = $_[2];
$pop = new Mail::POP3Client(
USER => $user,
PASSWORD => $passwd,
HOST => $server,
AUTH_MODE => "PASS",
DEBUG => 0
);
$i = 1;
$n = $pop->Count();
print STDERR "Clearing $n old messages on server...\n";
for ( $i = 1 ; $i <= $n ; $i++ )
{
print STDERR "------ Message $i\n";
print STDERR $pop->Body($i);
print STDERR "\n-----------------------\n";
$pop->Delete($i);
}
print STDERR "Old messages cleared.\n";
return ($n);
}
#---------------------------------------------------------
clear_mail( $ARGV[0], $ARGV[1], $ARGV[2] );
I know it is to remove the mail from the argurement defined account, but dunno the code in specific.. how can i insert lines to append all the mails to a log.. say "/tmp/log.txt".
Thanks!
I am relatively new to perl, am trying to write some stuff... can someone roughly explain each line do?:
#!/usr/bin/perl
use strict;
use Mail::POP3Client;
#---------------------------------------------------------
#
#
sub clear_mail
{
my $pop;
my $n;
my $i;
my $test_text;
my $user;
my $passwd;
my $server;
$server = $_[0];
$user = $_[1];
$passwd = $_[2];
$pop = new Mail::POP3Client(
USER => $user,
PASSWORD => $passwd,
HOST => $server,
AUTH_MODE => "PASS",
DEBUG => 0
);
$i = 1;
$n = $pop->Count();
print STDERR "Clearing $n old messages on server...\n";
for ( $i = 1 ; $i <= $n ; $i++ )
{
print STDERR "------ Message $i\n";
print STDERR $pop->Body($i);
print STDERR "\n-----------------------\n";
$pop->Delete($i);
}
print STDERR "Old messages cleared.\n";
return ($n);
}
#---------------------------------------------------------
clear_mail( $ARGV[0], $ARGV[1], $ARGV[2] );
I know it is to remove the mail from the argurement defined account, but dunno the code in specific.. how can i insert lines to append all the mails to a log.. say "/tmp/log.txt".
Thanks!
Solved! Go to Solution.
- Tags:
- Perl
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2006 05:49 PM
тАО09-07-2006 05:49 PM
Solution
Can you tell me what
# man Mail::POP3Client
or
# perldoc Mail::POP3Client
is not explaining enough? Explaining each line is a bit dumb imho.
# man perltoc
will give you the content list of what on-line documentation is available
Enjoy, Have FUN! H.Merijn
# man Mail::POP3Client
or
# perldoc Mail::POP3Client
is not explaining enough? Explaining each line is a bit dumb imho.
# man perltoc
will give you the content list of what on-line documentation is available
Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
- Tags:
- mailbox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2006 06:37 PM
тАО09-07-2006 06:37 PM
Re: Perl Scripting for mail handling
Hi Merijn,
Thanks figure it out..
Regards
Henry
Thanks figure it out..
Regards
Henry
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP