sendmail issue

Discussion in 'Perl Misc' started by lerameur, Sep 20, 2007.

  1. lerameur

    lerameur Guest

    HI again,

    I wrote this small script to test my send mail. The script is placed
    in the root directory and has the executable permission. It runs
    without error, but I never received the email:

    #!/usr/bin/perl -w
    use strict;

    open ( MAIL, "| /usr/lib/sendmail -t" );
    print MAIL "From: email address\n";
    print MAIL "To: lerameur\@yahoo.com\n";
    print MAIL "Subject: Something here \n\n";
    close ( MAIL );


    k
    lerameur, Sep 20, 2007
    #1
    1. Advertising

  2. lerameur <> writes:
    > I wrote this small script to test my send mail. The script is placed
    > in the root directory and has the executable permission. It runs
    > without error, but I never received the email:


    If that's the case, then your problem isn't in your perl script; it's
    in your mail server. I recommend finding a newsgroup related to your
    mail server, and asking about it there.

    -=Eric
    Eric Schwartz, Sep 20, 2007
    #2
    1. Advertising

  3. lerameur wrote:
    >
    > I wrote this small script to test my send mail. The script is placed
    > in the root directory and has the executable permission. It runs
    > without error,


    Because you ignore any errors that may be generated.

    > but I never received the email:
    >
    > #!/usr/bin/perl -w
    > use strict;
    >
    > open ( MAIL, "| /usr/lib/sendmail -t" );
    > print MAIL "From: email address\n";
    > print MAIL "To: lerameur\@yahoo.com\n";
    > print MAIL "Subject: Something here \n\n";
    > close ( MAIL );


    open my $MAIL, '|-', '/usr/lib/sendmail', '-t'
    or die "Cannot open pipe to sendmail: $!";

    print $MAIL <<'MAIL' or warn "Cannot print to sendmail: $!";
    From: email address
    To:
    Subject: Something here

    MAIL

    close $MAIL
    or warn $! ? "Error closing sendmail pipe: $!"
    : "Exit status $? from sendmail";



    John
    --
    Perl isn't a toolbox, but a small machine shop where you
    can special-order certain sorts of tools at low cost and
    in short order. -- Larry Wall
    John W. Krahn, Sep 20, 2007
    #3
  4. lerameur

    lerameur Guest

    I wrote this with the die command

    #!/usr/bin/perl -w
    use strict;

    open ( MAIL, "| /usr/lib/sendmail -t" ) or die ("Cannot open pipe to
    sendmail: $!");
    print MAIL "From: email address\n";
    print MAIL "To: lerameur\@yahoo.com\n";
    print MAIL "Subject: Something here \n\n";
    close ( MAIL ) or die ("Cannot close sendmail: $!");

    no errors, no mail receives


    k
    lerameur, Sep 20, 2007
    #4
  5. lerameur

    Tony Curtis Guest

    lerameur wrote:
    > I wrote this with the die command
    >
    > #!/usr/bin/perl -w
    > use strict;
    >
    > open ( MAIL, "| /usr/lib/sendmail -t" ) or die ("Cannot open pipe to
    > sendmail: $!");
    > print MAIL "From: email address\n";
    > print MAIL "To: lerameur\@yahoo.com\n";
    > print MAIL "Subject: Something here \n\n";
    > close ( MAIL ) or die ("Cannot close sendmail: $!");
    >
    > no errors, no mail receives


    then, as someone previously pointed out, the problem must be somewhere
    outside of perl, e.g. your local sendmail setup.

    hth
    t
    Tony Curtis, Sep 20, 2007
    #5
  6. lerameur

    smallpond Guest

    On Sep 20, 3:02 pm, lerameur <> wrote:
    > HI again,
    >
    > I wrote this small script to test my send mail. The script is placed
    > in the root directory and has the executable permission. It runs
    > without error, but I never received the email:
    >
    > #!/usr/bin/perl -w
    > use strict;
    >
    > open ( MAIL, "| /usr/lib/sendmail -t" );
    > print MAIL "From: email address\n";
    > print MAIL "To: lerameur\@yahoo.com\n";
    > print MAIL "Subject: Something here \n\n";
    > close ( MAIL );
    >
    > k



    Because you never gave it the end of the email, which
    is defined as a "." on a line by itself.
    smallpond, Sep 20, 2007
    #6
    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. Aaron Powell
    Replies:
    0
    Views:
    1,187
    Aaron Powell
    Jul 24, 2003
  2. jim

    Sendmail problem

    jim, Oct 24, 2003, in forum: Perl
    Replies:
    4
    Views:
    638
  3. Hmmm...
    Replies:
    4
    Views:
    2,089
    ChrisO
    Sep 6, 2004
  4. sugapablo
    Replies:
    0
    Views:
    2,139
    sugapablo
    Sep 21, 2007
  5. Andrzej Adam Filip
    Replies:
    0
    Views:
    4,058
    Andrzej Adam Filip
    Mar 31, 2008
Loading...

Share This Page