Click here to get back home

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

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
I have problem with POP3Client&Sendmail Module, Please Help. eng.john84 04-20-2007
Posted by eng.john84 on April 20, 2007, 4:34 am
Please log in for more thread options


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 ( 1234567890@bulksms.co.uk ) .
The Problem how to print the subject from POP3Client to the email part
( SUBJECT@bulksms.co.uk) 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)
HERE@bulksms.co.uk',
From => 'xxxxxxxxxxxx',
Subject => 'xxxxxxxxx',
Message => 'John',
);

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

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

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



</code>


Posted by yazeed on April 20, 2007, 10:25 am
Please log in for more thread options


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 ( 1234567...@bulksms.co.uk) .
> The Problem how to print the subject from POP3Client to the email part
> ( SUBJ...@bulksms.co.uk) at sendmail.
[...]


Try constructing a string that contains each recipient separated by
commas (eg. 12345678901@bulksms.co.uk,10987654321@bulksms.co.uk,...),
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


Posted by yazeed on April 20, 2007, 10:31 am
Please log in for more thread options


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 ( 1234567...@bulksms.co.uk) .
> The Problem how to print the subject from POP3Client to the email part
> ( SUBJ...@bulksms.co.uk) at sendmail.
[...]


Try constructing a string containing each recipient separated by a
comma (eg. 12345678901@bulksms.co.uk,10987654321@bulksms.co.uk,....),
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



Posted by eng.john84 on May 2, 2007, 12:00 pm
Please log in for more thread options


On Apr 20, 4:31 pm, yaz...@bulksms.com wrote:
> 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 ( 1234567...@bulksms.co.uk) .
> > The Problem how to print the subject from POP3Client to the email part
> > ( SUBJ...@bulksms.co.uk) at sendmail.
>
> [...]
>
> Try constructing a string containing each recipient separated by a
> comma (eg. 12345678...@bulksms.co.uk,10987654...@bulksms.co.uk,....),
> 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! .


Similar ThreadsPosted
Problem with Net::SSH::Perl module December 22, 2004, 12:38 pm
Problem using C module in perl January 5, 2006, 5:03 am
Problem installing GD module April 4, 2006, 12:26 pm
Problem Installing Module April 4, 2007, 10:02 am
Problem gettting module from CPAN September 19, 2004, 9:56 pm
problem installing Gtk2 Module January 10, 2005, 1:44 pm
problem with BerkeleyDB module and subdatabases February 27, 2005, 9:40 pm
Module install problem - AppConfig October 19, 2005, 2:04 pm
Module problem - Can't locate Mail/Sender.pm in @INC October 22, 2004, 11:19 am
problem using swig to create perl module October 6, 2005, 8:10 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap