I have problem with POP3Client&Sendmail Module, Please Help.

E

eng.john84

The below code contain two modules POP3Client & Sendmail .
The POP3Client used to get the subject from the header as numbers.
The Sendmail used to send message to ( (e-mail address removed) ) .
The Problem how to print the subject from POP3Client to the email part
( (e-mail address removed)) at sendmail.


<code>



use Mail::Sendmail;

use Mail::pOP3Client;


$pop = new Mail::pOP3Client( USER => "xxxxxxxxxxx",
PASSWORD => "xxxxxxxxxxx",
HOST => "xxxxxxxxxxx" ),
TIMEOUT => 1;
for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
/^Subject:.+\s(\d+)/i && print $1, "\n";
}
print "\n";
}

%mail = ( To => 'HOW TO PRINT THE SUBJECT(Numbers)
(e-mail address removed)',
From => 'xxxxxxxxxxxx',
Subject => 'xxxxxxxxx',
Message => 'John',
);

$mail{auth} = {user=>'xxxxxxxxx', password=>"xxxxxx", method=>"LOGIN",
required=>0 };

sendmail(%mail) or die $Mail::Sendmail::error;

print "OK. Log says:\n", $Mail::Sendmail::log;



</code>
 
Y

yazeed

Hi
The below code contain two modules POP3Client & Sendmail .
The POP3Client used to get the subject from the header as numbers.
The Sendmail used to send message to ( (e-mail address removed)) .
The Problem how to print the subject from POP3Client to the email part
( (e-mail address removed)) at sendmail.
[...]


Try constructing a string that contains each recipient separated by
commas (eg. (e-mail address removed),[email protected],...),
then use this string as the "To:" field.

Example:

my $numbers_string = "";
for (my $i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
if (/^Subject:.+\s(\d+)/i) {
$numbers_string += $1.",";
}
}
}

my %mail = ( To => $numbers_string,
From => 'xxxxxxxxxxx',
Subject => 'xxxxxxxxxxx',
Message => 'John',
);


Regards,
Yazeed
 
Y

yazeed

Hi
The below code contain two modules POP3Client & Sendmail .
The POP3Client used to get the subject from the header as numbers.
The Sendmail used to send message to ( (e-mail address removed)) .
The Problem how to print the subject from POP3Client to the email part
( (e-mail address removed)) at sendmail.
[...]


Try constructing a string containing each recipient separated by a
comma (eg. (e-mail address removed),[email protected],....),
then use this string as the "To:" field.

Example:

my $numbers_string = "";
for (my $i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
if (/^Subject:.+\s(\d+)/i) {
$numbers_string += $1.",";
}
}
print "\n";

}

my %mail = ( To => $numbers_string,
From => 'xxxxxxxxxxx',
Subject => 'xxxxxxxxxxx',
Message => 'John',
);


Regards,
Yazeed
 
E

eng.john84

Hi
The below code contain two modules POP3Client & Sendmail .
The POP3Client used to get the subject from the header as numbers.
The Sendmail used to send message to ( (e-mail address removed)) .
The Problem how to print the subject from POP3Client to the email part
( (e-mail address removed)) at sendmail.

[...]

Try constructing a string containing each recipient separated by a
comma (eg. (e-mail address removed),[email protected],....),
then use this string as the "To:" field.

Example:

my $numbers_string = "";
for (my $i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
if (/^Subject:.+\s(\d+)/i) {
$numbers_string += $1.",";
}
}
print "\n";

}

my %mail = ( To => $numbers_string,
From => 'xxxxxxxxxxx',
Subject => 'xxxxxxxxxxx',
Message => 'John',
);

Regards,
Yazeed








Thanks for your help

But when i trys the code it ype NO RECEPTION! .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top