Sendmail problem

Discussion in 'Perl' started by jim, Oct 24, 2003.

  1. jim

    jim Guest

    Hello,

    I am having a problem w/SendMail reporting: " No recipient addresses
    found in header".

    Funny thing is though, I properly recieve the email message.

    Thanks for your help.

    -jim



    Here is the code:


    sub my_send_mail
    {
    local($fromuser, $touser, $subject, $messagebody) = @_;

    local($old_path) = $ENV{"PATH"};


    $ENV{"PATH"} = "";
    $ENV{ENV} = "";

    open(SENDMAIL, "| /bin/sendmail -t -n") || &web_error ("Unable to open
    sendmail");

    $ENV{"PATH"} = $old_path;

    print SENDMAIL "To: $touser\n";
    print SENDMAIL "From: $fromuser\n";
    print SENDMAIL "Subject: $subject\n\n";
    print SENDMAIL "$messagebody\n";
    close(SENDMAIL);

    }
    jim, Oct 24, 2003
    #1
    1. Advertising

  2. jim

    Guest

    jim <defenderjim4@no__spam__juno.com> wrote in message news:<D0imb.4736$>...

    > I am having a problem w/SendMail


    So why are you posting to a (non-existant) newsgroup that is (or
    rather would be if it existed) about Perl?

    > Here is the code:


    That looks like it was written for Perl4. If it _was_ written for
    Perl4 that's OK. But if this was written recently it implies the
    author needs to update his Perl skills.

    >
    > sub my_send_mail
    > {
    > local($fromuser, $touser, $subject, $messagebody) = @_;


    Do not use local() where you want my() unless you need your code to
    run on Perl4. (You really should _not_ still be using Perl4).

    > local($old_path) = $ENV{"PATH"};


    >
    > $ENV{"PATH"} = "";


    No! That's one place where you could use local!

    local $ENV{PATH} = '';

    > $ENV{ENV} = "";
    >
    > open(SENDMAIL, "| /bin/sendmail -t -n") || &web_error ("Unable to open
    > sendmail");


    The there's another switch that is almost alwats used with 'sendmail
    -t' to disable dot handling (can't recall what it is). Why have you
    omitted it?

    Why is that & there?

    Why don't you include the error in your error message?

    > $ENV{"PATH"} = $old_path;


    You wouldn't need this if you'd used local.
    , Oct 28, 2003
    #2
    1. Advertising

  3. jim

    jim Guest

    Hey nobull,

    Thanks for your reply.

    The short story is I got it working. There was something in the body of
    the message that it didnt like.

    The long response follows:


    > So why are you posting to a (non-existant) newsgroup that is (or

    Well, if it is non-existent, then why are all these messages here?

    > That looks like it was written for Perl4. If it _was_ written for

    Yeah, I think so. It is legacy code written by someone else and I have
    had to work with it.

    > Perl4 that's OK.

    Yeah, I think so, dont know the original author or history.

    > Do not use local() where you want my() unless you need your code to

    No, does not need to run on perl4, changed above to my;

    Note delimeter at end of previous sentance: I think I have been
    programming too long when I end my sentences w/a semi colon.


    > Why have you omitted it?

    Haven't, just trying to get someone else's code working.

    > Why don't you include the error in your error message?

    Hhhmmm good point. Must have been late/tired.
    jim, Oct 30, 2003
    #3
  4. jim

    Guest

    jim <m4@no_spam_juno.com> wrote in message news:<z%9ob.9562$>...
    > > So why are you posting to a (non-existant) newsgroup that is (or

    > Well, if it is non-existent, then why are all these messages here?


    Ignorance, incompetance and compassion.

    For details, please see numerous previous theads.
    , Oct 30, 2003
    #4
  5. jim

    Guest

    jim <m4@no_spam_juno.com> wrote in message news:<z%9ob.9562$>...
    > The short story is I got it working. There was something in the body of
    > the message that it didnt like.


    A line starting with a dot perhaps?

    [ Re the swich to disable special treament for lines starting with a dot.. ]

    > > Why have you omitted it?

    > Haven't, just trying to get someone else's code working.


    Have you tried adding it?
    , Oct 30, 2003
    #5
    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. Andrea Williams

    Urgent SendMail Problem

    Andrea Williams, Dec 9, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    1,852
    Andrea Williams
    Dec 13, 2004
  2. swangdb

    Mailman - Sendmail problem

    swangdb, Aug 21, 2006, in forum: Python
    Replies:
    3
    Views:
    670
    swangdb
    Aug 21, 2006
  3. sugapablo
    Replies:
    0
    Views:
    2,140
    sugapablo
    Sep 21, 2007
  4. Andrzej Adam Filip
    Replies:
    0
    Views:
    4,060
    Andrzej Adam Filip
    Mar 31, 2008
  5. Supra

    sendmail unicode problem

    Supra, Jul 14, 2008, in forum: Perl
    Replies:
    6
    Views:
    5,007
    Supra
    Jul 15, 2008
Loading...

Share This Page