Friday, September 10th, 2010
Perl Email

Using CC method with Net::SMTP to send emails to multiple recipients

use Net::SMTP; $smtpconn = Net::SMTP->new('mail.w3mentor.com', hello => 'mycomputer.w3mentor.com'); $smtpconn->mail('mani@w3mentor.com'); $smtpconn->to('madhu@w3mentor.com'); $smtpconn->cc('pdeva@w3mentor.com');$smtpconn->data(); $smtpconn->datasend("To: \n"); $smtpconn->datasend("From: ITEM Raja \n");$smtpconn->datasend("Subject: Test E-mail\n\n"); $smtpconn->datasend("Hello,\nE-mail sample!\n"); $smtpconn->dataend(); $smtpconn->quit;

More Perl Email

Sending email to multiple recipients with Net::SMTP in Perl

use Net::SMTP; $smtpconn = Net::SMTP->new('mail.w3mentor.com', hello => 'mycomputer.w3mentor.com');$smtpconn->mail('mani@w3mentor.com'); $smtpconn->recipient($recipient1, $recipient2); $smtpconn->data();$smtpconn->datasend("To: \n"); $smtpconn->datasend("From: Item Raja \n"); $smtpconn->datasend("Subject: Test E-mail\n\n"); $smtpconn->datasend("Hello,\n E-mail sample!\n"); $smtpconn->dataend();$smtpconn->quit;

Sending email using SMTP in Perl

use Net::SMTP; $smtpconn = Net::SMTP->new('mail.example.com', hello => 'mycomputer.example.com');$smtpconn->mail('mani@w3mentor.com'); $smtpconn->to('madhu@w3mentor.com');$smtpconn->data(); $smtpconn->datasend("Hello,\n e-mail sample from me!\n"); $smtpconn->dataend(); $smtpconn->quit;

Display email subject from inbox using Mail::Box

To print subject lines, use the get() method.#!/usr/bin/perl -w use strict; use Mail::Box::POP3;my $folder = Mail::Box::POP3->new(server_name => 'mail.example.com', password => 'password', username => 'user@example.com') ...

Display individual email from inbox using Perl Mail::Box

You can retrieve individual messages by calling the message by its index.#!/usr/bin/perl -wuse strict; use Mail::Box::POP3;my $folder = Mail::Box::POP3->new(server_name => 'mail.example.com', password => ...

Using Mail::Box to display the number of emails in Perl

Mail::Box is another package, available from CPAN, for working with e-mail in Perl. In many ways, Mail::Box provides a more elegant ...

Delete emails in POP3 inbox using Perl

To mark a message for deletion, simply call the delete() method with the number of the message as the argument. When ...

Get number of email messages and the size of mailbox using Perl POP3

The popstat() method gives the number of messages along with the size of the mailbox.#!/usr/bin/perl -w use Net::POP3; use strict;my $username = "user\@example.com"; my ...

Get Email subject lines using Perl POP3

#!/usr/bin/perl -w use Net::POP3; use strict;my $username = "user\@example.com"; my $password = "password"; my $pop3conn = Net::POP3->new("mail.example.com", timeout => 30); my $nummsgs = $pop3conn->login($username,$password);for (my $i=1;$itop($i); print ...

Print Email Message IDs using Perl POP3

#!/usr/bin/perl -w use Net::POP3; use strict;my $username = "user\@example.com"; my $password = "password"; my $pop3conn = Net::POP3->new("mail.example.com", timeout => 30);if ($pop3conn->login($username,$password) > 0) { my $messages ...

Get and display POP3 Messages in Perl

We can retrieve the email message with the get() method, in Perl, called with the message number as an argument.#!/usr/bin/perl -w use ...

List POP3 Messages from mail server in Perl

#!/usr/bin/perl -w use strict; use Net::POP3; my $username = "user\@example.com"; my $password = "password"; my $pop3conn = Net::POP3->new("mail.example.com", timeout => 30);if ($pop3conn->login($username,$password) > 0) { print "You've ...

eXTReMe Tracker