sendmail

Discussion in 'Perl Misc' started by kd, Sep 29, 2005.

  1. kd

    kd Guest

    Hi all,

    I am working on a program which uses sendmail.I found that the sendmail
    directory was located at /usr/sbin/sendmail. I try to execute the
    following piece of code. But the program shows any errors nor executing
    it properly.Could you please let me know what the problem could
    be.Thanks in advance.

    - Karthik
    ===================================================
    #!/usr/bin/perl/
    use strict;
    use diagnostics;
    use warnings;
    system('clear');

    open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for
    sendmail: $!\n";
    print SENDMAIL <<"EOF";
    From: Karthik <karthik\@kmail.com>
    To: Karthik <karthik\@kmail.com>
    Subject: A relevant subject line
    Hey Wats up !!
    EOF
    close(SENDMAIL) or warn "sendmail didn't close nicely";
    ===================================================
     
    kd, Sep 29, 2005
    #1
    1. Advertisements

  2. "kd" <> wrote in
    news::

    > I am working on a program which uses sendmail.I found that the
    > sendmail directory was located at /usr/sbin/sendmail.


    Is that the directory, or the full path to the binary?

    > I try to execute the following piece of code. But the program shows
    > any errors nor executing it properly.


    Well, what are the errors it shows?

    > #!/usr/bin/perl/


    This is incorrect.

    #!/usr/bin/perl

    ....

    > print SENDMAIL <<"EOF";
    > From: Karthik <karthik\@kmail.com>
    > To: Karthik <karthik\@kmail.com>
    > Subject: A relevant subject line
    > Hey Wats up !!
    > EOF
    > close(SENDMAIL) or warn "sendmail didn't close nicely";


    Don't you need to signal the end of the message to sendmail by sending a
    ..CRLF to sendmail?

    Sinan

    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Sep 29, 2005
    #2
    1. Advertisements

  3. Shane

    Shane Guest

    On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:

    > Hi all,
    >
    > I am working on a program which uses sendmail.I found that the sendmail
    > directory was located at /usr/sbin/sendmail. I try to execute the
    > following piece of code. But the program shows any errors nor executing it
    > properly.Could you please let me know what the problem could be.Thanks in
    > advance.
    >
    > - Karthik
    > =================================================== #!/usr/bin/perl/
    > use strict;
    > use diagnostics;
    > use warnings;
    > system('clear');
    >
    > open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for
    > sendmail: $!\n";
    > print SENDMAIL <<"EOF";
    > From: Karthik <karthik\@kmail.com>
    > To: Karthik <karthik\@kmail.com>
    > Subject: A relevant subject line


    you need a blank line between your headers ^^ above and your body below

    > Hey Wats up !!
    > EOF
    > close(SENDMAIL) or warn "sendmail didn't close nicely";
    > ===================================================



    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Sep 29, 2005
    #3
  4. Shane

    Shane Guest

    On Thu, 29 Sep 2005 13:00:11 +1200, Shane wrote:

    > On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:


    >> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for



    Oh and.. should there be a pipe in your path?

    "|/usr/sbin/sendmail"
    ^^^
    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Sep 29, 2005
    #4
  5. Shane <-a-geek.net> wrote in
    news:p-a-geek.net:

    > On Thu, 29 Sep 2005 13:00:11 +1200, Shane wrote:
    >
    >> On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:

    >
    >>> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or
    >>> die "Can't fork for

    >
    > Oh and.. should there be a pipe in your path?
    >
    > "|/usr/sbin/sendmail"
    > ^^^


    Yes.

    perldoc -f open

    perldoc -q send

    Sinan


    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Sep 29, 2005
    #5
  6. Shane <-a-geek.net> wrote:
    > On Thu, 29 Sep 2005 13:00:11 +1200, Shane wrote:
    >
    >> On Wed, 28 Sep 2005 16:35:26 -0700, kd wrote:

    >
    >>> open(SENDMAIL,"|/usr/sbin/sendmail -oi -t -odq")or die "Can't fork for

    >
    >
    > Oh and.. should there be a pipe in your path?
    >
    > "|/usr/sbin/sendmail"
    > ^^^



    Of course there should be.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Sep 29, 2005
    #6
  7. Anno Siegel

    Anno Siegel Guest

    A. Sinan Unur <> wrote in comp.lang.perl.misc:
    > "kd" <> wrote in
    > news::


    [...]

    > > print SENDMAIL <<"EOF";
    > > From: Karthik <karthik\@kmail.com>
    > > To: Karthik <karthik\@kmail.com>
    > > Subject: A relevant subject line
    > > Hey Wats up !!
    > > EOF
    > > close(SENDMAIL) or warn "sendmail didn't close nicely";

    >
    > Don't you need to signal the end of the message to sendmail by sending a
    > .CRLF to sendmail?


    No, closing its input is enough. You need dot-on-a-line to make sendmail
    quit *before* it reaches eof.

    Anno
    --
    If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers.
     
    Anno Siegel, Oct 7, 2005
    #7
  8. -berlin.de (Anno Siegel) wrote in
    news:di5oh3$rab$-Berlin.DE:

    > A. Sinan Unur <> wrote in comp.lang.perl.misc:
    >> "kd" <> wrote in
    >> news::

    >
    > [...]
    >
    >> > print SENDMAIL <<"EOF";
    >> > From: Karthik <karthik\@kmail.com>
    >> > To: Karthik <karthik\@kmail.com>
    >> > Subject: A relevant subject line
    >> > Hey Wats up !!
    >> > EOF
    >> > close(SENDMAIL) or warn "sendmail didn't close nicely";

    >>
    >> Don't you need to signal the end of the message to sendmail by
    >> sending a .CRLF to sendmail?

    >
    > No, closing its input is enough. You need dot-on-a-line to make
    > sendmail quit *before* it reaches eof.


    I learn something new every day. Thanks.

    Sinan

    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Oct 7, 2005
    #8
    1. Advertisements

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,327
    Aaron Powell
    Jul 24, 2003
  2. jim

    Sendmail problem

    jim, Oct 24, 2003, in forum: Perl
    Replies:
    4
    Views:
    829
  3. Hmmm...
    Replies:
    4
    Views:
    2,361
    ChrisO
    Sep 6, 2004
  4. peterson
    Replies:
    0
    Views:
    827
    peterson
    Dec 30, 2003
  5. Glen Wolinsky

    Multiple email when using SendMail

    Glen Wolinsky, Jan 28, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    799
    Steven Cheng[MSFT]
    Jan 31, 2004
  6. Andrea Williams

    Urgent SendMail Problem

    Andrea Williams, Dec 9, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    2,083
    Andrea Williams
    Dec 13, 2004
  7. sugapablo
    Replies:
    0
    Views:
    2,445
    sugapablo
    Sep 21, 2007
  8. Andrzej Adam Filip
    Replies:
    0
    Views:
    4,473
    Andrzej Adam Filip
    Mar 31, 2008
Loading...