[21808] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4012 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 22 21:10:30 2002

Date: Tue, 22 Oct 2002 18:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 22 Oct 2002     Volume: 10 Number: 4012

Today's topics:
        Sending Mail, How many SMTP Servers used? <christoph.wagner@christies.co.at>
    Re: Sending Mail, How many SMTP Servers used? <goldbb2@earthlink.net>
    Re: Sending Mail, How many SMTP Servers used? <johngnub@worldnet.att.net>
        Shopping Cart Processing (Shelby)
        warnings::register, no warnings, and inheritance <heather710101@yahoo.com>
    Re: while loop to stop take #2 <kashmirnospam@bellnet.ca>
    Re: ypur//warning perl 58 <goldbb2@earthlink.net>
    Re: ypur//warning perl 58 (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 22 Oct 2002 22:40:49 +0200
From: "Christoph Wagner" <christoph.wagner@christies.co.at>
Subject: Sending Mail, How many SMTP Servers used?
Message-Id: <3db5b793$0$27892$91cee783@newsreader02.highway.telekom.at>

Dear all,

I need to explain why some Mails are not send, are missing.
About 5 of 1000 Mails are not.

Is following correct?

SMTP Protocoll sends Mails directly from the Senders Mail Server to
Recipients Mail Server,
there is no other MailServer between.(2 SMTP Servers used)

I checked the RFC for SMTP, also Mail Headers and I think this is correct

I know this is not a perl specific question, but I need to be sure.

Thanks,

Christoph








------------------------------

Date: Tue, 22 Oct 2002 18:36:26 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Sending Mail, How many SMTP Servers used?
Message-Id: <3DB5D2EA.689610BD@earthlink.net>

Christoph Wagner wrote:
> 
> Dear all,
> 
> I need to explain why some Mails are not send, are missing.
> About 5 of 1000 Mails are not.
> 
> Is following correct?
> 
> SMTP Protocoll sends Mails directly from the Senders Mail Server to
> Recipients Mail Server,
> there is no other MailServer between.(2 SMTP Servers used)

Sorry, no.

The SMTP protocol transfers mail from the originator's machine, to his
SMTP server.

This server will then store it, so it can forward it to the next step
when it's CPU/bandwidth usage is low.

Some messages may be to users on that machine, or users whose mail is
served by that machine with the POP or IMAP protocols -- these get moved
to local files.

Other messages, though, get forwarded -- possibly by the original SMTP
process, possibly by another process on that machine, possibly by a
process on another machine but which shares the filesystem.

That other program will go through those files which get forwarded, and
perform DNS MX lookups on the domain-parts of the email addresses.

For each host that was looked up, it connects to that host, and uses the
SMTP protocol to forward all of the messages which go to that host.  As
each message is transferred successfully, it gets removed from the file
the forwarding program read it from.

From there, it will *either* go into a local file, or get fowarded
*again*.  For example, all messages of the form [a]@[b].somedomain.com
might get sent to the machine mail.somedomain.com, then get forwarded
(via SMTP) to the approproate machine based on [b], then get dropped in
a local file based on [a].

In point of fact, messages can get forwarded almost any number of times,
so long as they don't end up travelling in a loop.

If, at any point, the mail cannot be forwarded then it will send a
message back to the originator saying so.  For some times of errors (eg,
if it couldn't connect), it will try again, and maybe eventually get the
message through.  For some types of failures, it's "fatal", and won't
retry (eg, if the recipient doesn't exist on the destination machine, or
if his mailbox is full).

Anyway, if you send 5000 mails, and 4995 go through, you (the sender)
should get 5 messages in your mailbox saying that the mail couldn't be
sent.

Of course, this only works if your mail sending program uses your proper
email address in the "RCPT FROM" SMTP command.  (Note that this is
mostly unrelated to the email address in the "From:" MIME header ...
they are usually the same, but need not be).

> I checked the RFC for SMTP, also Mail Headers and I think this is
> correct
> 
> I know this is not a perl specific question, but I need to be sure.

If you want to send mail with the greater assurance of knowing whether
or not you succeed, do the DNS MX queries yourself (with the Net::DNS
module), and then send your messages to the resulting hosts.  There's a
good chance that if you do that, you'll find out right away that if
there's a failure to send.  But it's slower.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


------------------------------

Date: Tue, 22 Oct 2002 23:08:29 GMT
From: "john bennett" <johngnub@worldnet.att.net>
Subject: Re: Sending Mail, How many SMTP Servers used?
Message-Id: <NTkt9.18807$Mb3.651316@bgtnsc04-news.ops.worldnet.att.net>

If the emails are getting "lost" or just in delay (maybe a long delay) on
the way, Dont forget to look at the
log files for the sender server, if it is a perl useing a module to send the
email, check to see the
Module has a Verbose or debug option to help track down the errror, No not a
Perl thing,
Just a Sysadmin thing.

? Do we know that the email was not sent ? Or only not recived ?

2 cents JB

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message
news:3DB5D2EA.689610BD@earthlink.net...
> Christoph Wagner wrote:
> >
> > Dear all,
> >
> > I need to explain why some Mails are not send, are missing.
> > About 5 of 1000 Mails are not.
> >
> > Is following correct?
> >
> > SMTP Protocoll sends Mails directly from the Senders Mail Server to
> > Recipients Mail Server,
> > there is no other MailServer between.(2 SMTP Servers used)
>
> Sorry, no.
>
> The SMTP protocol transfers mail from the originator's machine, to his
> SMTP server.
>
> This server will then store it, so it can forward it to the next step
> when it's CPU/bandwidth usage is low.
>
> Some messages may be to users on that machine, or users whose mail is
> served by that machine with the POP or IMAP protocols -- these get moved
> to local files.
>
> Other messages, though, get forwarded -- possibly by the original SMTP
> process, possibly by another process on that machine, possibly by a
> process on another machine but which shares the filesystem.
>
> That other program will go through those files which get forwarded, and
> perform DNS MX lookups on the domain-parts of the email addresses.
>
> For each host that was looked up, it connects to that host, and uses the
> SMTP protocol to forward all of the messages which go to that host.  As
> each message is transferred successfully, it gets removed from the file
> the forwarding program read it from.
>
> From there, it will *either* go into a local file, or get fowarded
> *again*.  For example, all messages of the form [a]@[b].somedomain.com
> might get sent to the machine mail.somedomain.com, then get forwarded
> (via SMTP) to the approproate machine based on [b], then get dropped in
> a local file based on [a].
>
> In point of fact, messages can get forwarded almost any number of times,
> so long as they don't end up travelling in a loop.
>
> If, at any point, the mail cannot be forwarded then it will send a
> message back to the originator saying so.  For some times of errors (eg,
> if it couldn't connect), it will try again, and maybe eventually get the
> message through.  For some types of failures, it's "fatal", and won't
> retry (eg, if the recipient doesn't exist on the destination machine, or
> if his mailbox is full).
>
> Anyway, if you send 5000 mails, and 4995 go through, you (the sender)
> should get 5 messages in your mailbox saying that the mail couldn't be
> sent.
>
> Of course, this only works if your mail sending program uses your proper
> email address in the "RCPT FROM" SMTP command.  (Note that this is
> mostly unrelated to the email address in the "From:" MIME header ...
> they are usually the same, but need not be).
>
> > I checked the RFC for SMTP, also Mail Headers and I think this is
> > correct
> >
> > I know this is not a perl specific question, but I need to be sure.
>
> If you want to send mail with the greater assurance of knowing whether
> or not you succeed, do the DNS MX queries yourself (with the Net::DNS
> module), and then send your messages to the resulting hosts.  There's a
> good chance that if you do that, you'll find out right away that if
> there's a failure to send.  But it's slower.
>
> --
> my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
> ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]




------------------------------

Date: 22 Oct 2002 13:57:49 -0700
From: webmaster@smwebdesigns.com (Shelby)
Subject: Shopping Cart Processing
Message-Id: <ed11fbd8.0210221257.735f7bb1@posting.google.com>

I'm sending Credit Card info to a program that dials up a bank to
verify the number and to charge the account but if the window is
exited early the account is charge but the order is not sent via
e-mail. Is there a way that I can keep the perl program running unil
it reaches a default timeout or til the program returns the needed
info? If I can make sure it runs until the e-mail is sent it would be
great. Any help would be great.

Thanks
Shelby


------------------------------

Date: Tue, 22 Oct 2002 23:31:18 +0000 (UTC)
From: Da Witch <heather710101@yahoo.com>
Subject: warnings::register, no warnings, and inheritance
Message-Id: <ap4n46$708$1@reader1.panix.com>


I'm having screwy results using warnings::register and inheritance.

For example, consider this

  # Foo.pm
  package Foo;
  use warnings;
  use warnings::register;
  sub foo { warn "foo called" if warnings::enabled() }
  1;
  
  # Bar.pm
  package Bar;
  use warnings;
  use base 'Foo';
  sub foo { $_[0]->SUPER::foo() }
  1;
  
  # test.pl
  use warnings;
  use Bar;
  no warnings 'Foo';       # doesn't turn off warnings from Bar!
  Bar->foo;

Despite the "no warnings 'Foo'":

  % perl test.pl
  foo called at Foo.pm line 5.

Is there any way for test.pl to turn off these warnings?  (If not, it
is certainly a design bug.)

Thanks for the feedback,

h.




------------------------------

Date: Tue, 22 Oct 2002 14:17:49 -0400
From: "Kashmir" <kashmirnospam@bellnet.ca>
Subject: Re: while loop to stop take #2
Message-Id: <iDgt9.4038$Kf.741619@news20.bellglobal.com>

Thanks to all of you,

As mentionned in an another post I am new to the world of Perl. I fail to
have read everything about the operators. I have the gecko book and spend
most of my time reading/trying/debugging/posting/reading at a slow pace.

Thanks for the ( defined($_ = <FIC>)  &&...... I have tried it and it works
great.

Kashmir



"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnar87bo.ebs.tadmc@magna.augustmail.com...
> Kashmir <kashmirnospam@bellnet.ca> wrote:
>
> > What I want to do is stop a while
> > loop if it reads from a text file the words "Session Number:"
> >
> > I received two suggestions which are:
> >
> > #1-    while (<FIC>) && ($_ !~ (/^Session Number:(.*)$/)))
>
>
> That is a horrid "solution", seeing as it will not even compile.
>
> Please post Real Perl Code, not pseudocode.
>
> Please use copy/paste rather than attempting to retype code.
>
> Please see the Posting Guidelines that are posted here weekly.
>
>
> > The && ($_ !~ (/^Session Number:(.*)$/))) solution is not working
>
>
> You must get it to compile before you can even try it to see
> if it is "working".
>
>
> > The while loop is simply not executed at all
>
>
> Since you have not put anything into $_, that match can never succeed.
>
>
> > Can somebody sort it out. I have read
> > about && and $_ and still no light.
>
>
> See the "I/O Operators" section in perlop.pod:
>
>    Ordinarily you must assign the returned value to a variable, but
>    there is one situation where an automatic assignment happens...
>
> Your situation is not that one situation, so you must assign
> it yourself:
>
>    while ( defined($_ = <FIC>) && ($_ !~ /^Session Number:/))
>
> (the  (.*)$ at the end of the pattern serves no purpose, I removed it)
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




------------------------------

Date: Tue, 22 Oct 2002 19:11:49 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: ypur//warning perl 58
Message-Id: <3DB5DB34.F810A3C5@earthlink.net>

serge.john.swilting wrote:
> 
> est ce que programme marche chez vous avec un perl58
> 
> attention
> warning ypur software
> 
> #!/usr/local/bin/perl -w

You got that line right, but you're missing the line that should follow
next:
   use strict;

> use Net::NNTP;
> 
> {#slurp

What's this for?

> $programme=&programme;

Why do you call the subroutine as "&subname", instead of "subname()"?

Also, you're missing a declaration for the $programme variable.

> {#slurp

What's this for?

> eval `$programme`;

What do you think this does?

> sub programme{
> 
> {#slurp

What's this for?

> $serveur='news.wanadoo.fr';
> 
> {#slurp

What's this for?

> $nntp=Net::NNTP->new($serveur) or die "impossible de se connecter ˆ
> $serveur:$@\n";

You forgot to declare the $nntp variable.

> {#slurp

What's this for?

> $liste=$nntp->list();

You should declare the variable $liste.

> {#slurp

What's this for?

> $programme1=&nouvelle_fonction1;

You should declare the variable $programme1.
Why are you using the &subname syntax instead of the subname() syntax?

> {#slurp

What's this for?

> eval `$programme1`;

What do you think this does?

> {#slurp

What's this for?

> sub nouvelle_fonction1{
> 
> {#slurp

What's this for?

> while(<$groupe,$liste,$nbr,$premier,$dernier,$group,$i>){

What do you think that this does?

> print;
> 
> {#slurp

What's this for?

>     $programme2=&foreach;

There is a "foreach" keyword in perl ... don't write a subroutine with
the same name... it causes confusion.

And of course, you should be using the subname() syntax for calling
subroutines.

>     eval `$programme2`;

What do you think that this does?

> sub foreach{
> 
> {#slurp

What's this for?

> sub group{
> ($nbr,$premier,$dernier,$group)=$nntp->(&foreach);
> }

This are global variables -- you shouldn't use globals unless you
absolutely need to -- it's bad style.  Instead, have group() return the
values as a list.

What do you think that $nntp->( anything ) does?

> {#slurp

What's this for?

> sub foreach{

This is the second time you're declaring a subroutine named foreach.

> {#slurp

What's this for?

> foreach $groupe(keys %$liste)
> 
> {
> 
> {#slurp

What's this for?

> print $liste->{$groupe}->[$i];
> 
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }
> }

Hmm, looks like the end of a LISP program, not a Perl program :)

You've got too many things wrong with your program to count -- I think
you should read a few more perl books :)

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


------------------------------

Date: Tue, 22 Oct 2002 19:41:53 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: ypur//warning perl 58
Message-Id: <slrnarbs2h.2u1.tadmc@magna.augustmail.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> serge.john.swilting wrote:

[snip what I suppose you could call "code"]

> You've got too many things wrong with your program to count


It appears to be the same program that was posted here last March:

   Message-ID: <3C99E6EC.8B8B9A54@wanadoo.fr>

Hasn't gotten it fixed yet, I guess...


I noticed this because I did what Bernard did:

   Message-ID: <a7esa2$bsn$1@news.tpi.pl>

:-)

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4012
***************************************


home help back first fref pref prev next nref lref last post