Problematic delay in script

Discussion in 'Perl Misc' started by \Dandy\ Randy, Sep 17, 2003.

  1. Hello, I have created a mailing program for our company that sends out
    emails to our client database. There seems to be a delay in the script or
    the processing of the emails. Here is how it works. The email addresses are
    stored in a simple text file, one on top of each other. Each email is sent
    through a foreach loop. I use this code to get email addresses and send the
    emails:

    open (ADDRESSES, "<address.txt") or die "Can't open file: $!";
    @list=<ADDRESSES>;
    close(ADDRESSES);

    $mailprog="/usr/sbin/sendmail -t";

    foreach $list (@list) {
    chomp ($list);
    ($name,$email)=split(/\|/,$list);

    open (MAIL, "|$mailprog") or die "Can't open main program: $!";
    print MAIL "From: $adminname <$adminemail>\n";
    print MAIL "To: $fullname <$email>\n";
    print MAIL "Subject: $subject\n";
    print MAIL "MIME-Version: 1.0\n";
    print MAIL "X-MSMail-Priority: $priority\n";
    print MAIL "Content-Type: multipart/alternative;\n";
    print MAIL " boundary=\"separator\"\n\n";
    print MAIL "This is a multi-part message in MIME format.\n\n";
    print MAIL "--separator\n";
    print MAIL "Content-Type: text/plain;\n";
    print MAIL " charset=\"iso-8859-1\"\n\n";
    print MAIL "@textonly\n\n";
    print MAIL "--separator\n";
    print MAIL "Content-Type: text/html;\n";
    print MAIL " charset=\"iso-8859-1\"\n\n";
    print MAIL "@content\n\n";
    print MAIL "--separator--";
    close (MAIL);
    }

    print "Confirmation Message";

    For testing purposes, the address.txt file contains 100 email addresses ...
    all different, but in the end end up in my inbox ... so if I recieve 100
    emails the script works. Well it does ... I do get the 100 emails but heres
    the thing ... almost right away I get about 60-70 emails ... but then the
    other 30 seem to get delivered at random intervals. Some take 5 minutes,
    some take 5 hours. I am puzzled why so many take so long to get delivered?
    Am I overloading sendmail? or maybe my email account? Your
    thoughts/reccommendations are appriciated.

    Randy
    \Dandy\ Randy, Sep 17, 2003
    #1
    1. Advertising

  2. \"Dandy\" Randy <> wrote:

    > Hello, I have created a mailing program for our company that sends out
    > emails to our client database.


    > Your
    > thoughts/reccommendations are appriciated.



    use Mail::Bulkmail;


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Sep 17, 2003
    #2
    1. Advertising

  3. \Dandy\ Randy

    Beau Schwabe Guest

    Just for test... try halving your database....i.e. send two chunks of
    50 emails. Does the first 50 go through ok? The second? or does it
    stop at 20 or so and spit the remainder 30 out at intermittent
    intervals?

    -Beau Schwabe

    >Hello, I have created a mailing program for our company that sends out
    >emails to our client database. There seems to be a delay in the script or
    >the processing of the emails. Here is how it works. The email addresses are
    >stored in a simple text file, one on top of each other. Each email is sent
    >through a foreach loop. I use this code to get email addresses and send the
    >emails:
    >
    >open (ADDRESSES, "<address.txt") or die "Can't open file: $!";
    > @list=<ADDRESSES>;
    >close(ADDRESSES);
    >
    >$mailprog="/usr/sbin/sendmail -t";
    >
    >foreach $list (@list) {
    >chomp ($list);
    >($name,$email)=split(/\|/,$list);
    >
    >open (MAIL, "|$mailprog") or die "Can't open main program: $!";
    >print MAIL "From: $adminname <$adminemail>\n";
    >print MAIL "To: $fullname <$email>\n";
    >print MAIL "Subject: $subject\n";
    >print MAIL "MIME-Version: 1.0\n";
    >print MAIL "X-MSMail-Priority: $priority\n";
    >print MAIL "Content-Type: multipart/alternative;\n";
    >print MAIL " boundary=\"separator\"\n\n";
    >print MAIL "This is a multi-part message in MIME format.\n\n";
    >print MAIL "--separator\n";
    >print MAIL "Content-Type: text/plain;\n";
    >print MAIL " charset=\"iso-8859-1\"\n\n";
    >print MAIL "@textonly\n\n";
    >print MAIL "--separator\n";
    >print MAIL "Content-Type: text/html;\n";
    >print MAIL " charset=\"iso-8859-1\"\n\n";
    >print MAIL "@content\n\n";
    >print MAIL "--separator--";
    >close (MAIL);
    >}
    >
    >print "Confirmation Message";
    >
    >For testing purposes, the address.txt file contains 100 email addresses ...
    >all different, but in the end end up in my inbox ... so if I recieve 100
    >emails the script works. Well it does ... I do get the 100 emails but heres
    >the thing ... almost right away I get about 60-70 emails ... but then the
    >other 30 seem to get delivered at random intervals. Some take 5 minutes,
    >some take 5 hours. I am puzzled why so many take so long to get delivered?
    >Am I overloading sendmail? or maybe my email account? Your
    >thoughts/reccommendations are appriciated.
    >
    >Randy
    >
    >
    Beau Schwabe, Sep 17, 2003
    #3
  4. \"Dandy\" Randy <> wrote:

    > print MAIL "@content\n\n";



    That adds space characters to the body of the email message.

    Is that what you want it to do?



    perldoc -q spaces

    Why do I get weird spaces when I print an array of lines?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Sep 17, 2003
    #4
  5. Yes, this \n\n is required at the end of the html body content, otherwise
    the multipart html will send process the separators correctly.

    "Tad McClellan" <> wrote in message
    news:...
    > \"Dandy\" Randy <> wrote:
    >
    > > print MAIL "@content\n\n";

    >
    >
    > That adds space characters to the body of the email message.
    >
    > Is that what you want it to do?
    >
    >
    >
    > perldoc -q spaces
    >
    > Why do I get weird spaces when I print an array of lines?
    >
    >
    > --
    > Tad McClellan SGML consulting
    > Perl programming
    > Fort Worth, Texas
    \Dandy\ Randy, Sep 17, 2003
    #5
  6. > use Mail::Bulkmail;

    I do not believe my hosting company had this module installed.

    R
    \Dandy\ Randy, Sep 17, 2003
    #6
  7. [TOFU rearranged to proper chronological order. Please don't do
    that.]

    "Dandy" Randy <> wrote:

    >
    > "Tad McClellan" <> wrote in message
    > news:...
    >> \"Dandy\" Randy <> wrote:
    >>
    >> > print MAIL "@content\n\n";

    >>
    >>
    >> That adds space characters to the body of the email message.
    >>
    >> Is that what you want it to do?
    >>
    >>
    >> perldoc -q spaces
    >>
    >> Why do I get weird spaces when I print an array of lines?


    > Yes, this \n\n is required at the end of the html body content,
    > otherwise the multipart html will send process the separators
    > correctly.


    The "\n\n" is not what Tad was talking about. If you read the FAQ
    entry he referred to you'll see what Tad was asking.

    --
    David Wall
    David K. Wall, Sep 17, 2003
    #7
  8. "Beau Schwabe" <> wrote
    news:...
    > Just for test... try halving your database....i.e. send two chunks of
    > 50 emails. Does the first 50 go through ok? The second? or does it
    > stop at 20 or so and spit the remainder 30 out at intermittent
    > intervals?


    Beau, I did a test a you suggested ...

    Test #1
    Sent: 50 emails all to my inbox
    Result: All 50 delivered timely ... within 30 seconds

    --- Waiting 2 minutes before next test

    Test #2
    Sent: 50 emails all to my inbox (again, same addresses)
    Result: 49 delivered timely ... within 30 seconds. 1 email has not arrived.
    most likely will at some point

    --- Waiting 2 minutes before next test

    Test #3
    Sent: 100 emails all to my inbox (same addresses)
    Result: 85 delivered timely ... within 30 seconds. 15 emails have not
    arrived.
    \Dandy\ Randy, Sep 17, 2003
    #8
  9. \"Dandy\" Randy <> wrote:
    >> use Mail::Bulkmail;

    >
    > I do not believe my hosting company had this module installed.



    Then install it yourself.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Sep 17, 2003
    #9
  10. > > I do not believe my hosting company had this module installed.
    >
    >
    > Then install it yourself.


    ???
    \Dandy\ Randy, Sep 17, 2003
    #10
  11. \Dandy\ Randy

    Sam Holden Guest

    On Wed, 17 Sep 2003 22:59:58 GMT, \"Dandy\" Randy <> wrote:
    >> > I do not believe my hosting company had this module installed.

    >>
    >>
    >> Then install it yourself.

    >
    > ???


    RTFM

    perldoc -q module

    --
    Sam Holden
    Sam Holden, Sep 18, 2003
    #11
  12. "Sam Holden" <> wrote in message
    > RTFM
    >
    > perldoc -q module


    Sam, I don't actually have perl installed locally, so I dont have access to
    perldoc information other than what I find on www.perldoc.com ... could you
    post instruction? TIA!

    R
    \Dandy\ Randy, Sep 18, 2003
    #12
  13. \"Dandy\" Randy wrote:
    > Sam, I don't actually have perl installed locally, so I dont have access to
    > perldoc information other than what I find on www.perldoc.com ... could you
    > post instruction? TIA!


    You're not trying very hard. If you've got access to the documentation
    on the web, go to the FAQ and try searching for the obvious: "install"
    (success on the first hit) or "module" (third hit) or "CPAN" (first
    hit) ...

    Chief S.
    Chief Squawtendrawpet, Sep 18, 2003
    #13
  14. "\"Dandy\" Randy" <> writes:
    > "Sam Holden" <> wrote in message
    >> RTFM
    >>
    >> perldoc -q module

    >
    > Sam, I don't actually have perl installed locally, so I dont have access to
    > perldoc information other than what I find on www.perldoc.com ... could you
    > post instruction? TIA!


    Perl can be installed on every operating system I personally can
    conceive of you actually running. So go out and install it today!
    Among the many benefits, you will gain the ability to test your perl
    programs before uploading them to your hosting provider (This is so
    useful, I can't imagine why anybody would not want to do this), and a
    local copy of the latest and greatest Perl documentation that you are
    guaranteed matches what is installed.

    I'm not going to bother posting the URL on perldoc.com because:

    A) Somebody else probably will anyway.
    B) You're more than capable, and unlike me, you care.

    But it's on there. Have fun.

    -=Eric
    --
    Come to think of it, there are already a million monkeys on a million
    typewriters, and Usenet is NOTHING like Shakespeare.
    -- Blair Houghton.
    Eric Schwartz, Sep 18, 2003
    #14
  15. \Dandy\ Randy

    Sam Holden Guest

    On Thu, 18 Sep 2003 00:03:08 GMT, \"Dandy\" Randy <> wrote:
    > "Sam Holden" <> wrote in message
    >> RTFM
    >>
    >> perldoc -q module

    >
    > Sam, I don't actually have perl installed locally, so I dont have access to
    > perldoc information other than what I find on www.perldoc.com ... could you
    > post instruction? TIA!


    The Laziness virtue is about reducing overall work, not reducing your own work
    by getting others to do trivial things for you.

    --
    Sam Holden
    Sam Holden, Sep 18, 2003
    #15
  16. \"Dandy\" Randy <> wrote:

    > I don't actually have perl installed locally,



    Why not?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Sep 18, 2003
    #16
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lim Siew Cheng

    Re: Problematic Postbacks

    Lim Siew Cheng, Aug 12, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    374
    IbrahimMalluf
    Aug 12, 2003
  2. Duray AKAR

    Problematic Postbacks

    Duray AKAR, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    333
    Duray AKAR
    Aug 12, 2003
  3. Fraggle
    Replies:
    1
    Views:
    426
    Fraggle
    Nov 27, 2003
  4. Jason Shohet

    XHTML problematic, in xml used w/ .net

    Jason Shohet, Jun 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    325
    Trevor Benedict R
    Jun 30, 2004
  5. Danny Ni

    ASP.Net Datagrid paging problematic?

    Danny Ni, Oct 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    465
    Saravana
    Oct 30, 2004
Loading...

Share This Page