sendmail not working - any alternatives?

Discussion in 'Perl Misc' started by John, Oct 12, 2013.

  1. John

    John Guest

    My web site provider has trouble getting sendmail to work.

    This is a trimmed down versio on a perl file that used to work just fine for
    years and then it quit working. I've contacted them to no avail:


    #!/usr/bin/perl
    print "Content-Type: text/html; charset=iso-8859-1\n\n";
    print '<html><head>';
    print '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
    print '</head><body>';
    $i=0;
    &testmail;
    print "Testing email $i <br>(1=success, 0=fail)<br>";
    print "</body></HTML>";

    sub testmail
    {
    #open(MAIL,"|/usr/sbin/sendmail -t") || return 0;
    open(MAIL,"|/usr/lib/sendmail -t") || return 0;
    #open(MAIL,"|/usr/bin/sendmail -t") || return 0;
    select (MAIL);
    print "To: blahblah\@whatever.com\n";
    print "From: blahblah\@whatever.com\n";
    print "Subject: testing\n";
    print "\n";
    print "This is message.\n";
    close(MAIL);
    select (STDOUT);
    $i=1;
    }

    The code returns:

    "Testing email 1
    (1=success, 0=fail)"

    but no email ever gets to the receiver (yes, I tried with actual working
    addresses).

    It works just fine on another domain host provider but I need to get it to work
    on this particular.

    What alternatives can I try?
    John, Oct 12, 2013
    #1
    1. Advertising

  2. In article <>,
    John <> wrote:

    > My web site provider has trouble getting sendmail to work.
    >
    > This is a trimmed down versio on a perl file that used to work just fine for
    > years and then it quit working. I've contacted them to no avail:
    >
    >
    > #!/usr/bin/perl
    > print "Content-Type: text/html; charset=iso-8859-1\n\n";
    > print '<html><head>';
    > print '<meta http-equiv="Content-Type" content="text/html;
    > charset=iso-8859-1">';
    > print '</head><body>';
    > $i=0;
    > &testmail;
    > print "Testing email $i <br>(1=success, 0=fail)<br>";
    > print "</body></HTML>";
    >
    > sub testmail
    > {
    > #open(MAIL,"|/usr/sbin/sendmail -t") || return 0;
    > open(MAIL,"|/usr/lib/sendmail -t") || return 0;
    > #open(MAIL,"|/usr/bin/sendmail -t") || return 0;
    > select (MAIL);
    > print "To: blahblah\@whatever.com\n";
    > print "From: blahblah\@whatever.com\n";
    > print "Subject: testing\n";
    > print "\n";
    > print "This is message.\n";
    > close(MAIL);
    > select (STDOUT);
    > $i=1;
    > }
    >
    > The code returns:
    >
    > "Testing email 1
    > (1=success, 0=fail)"
    >
    > but no email ever gets to the receiver (yes, I tried with actual working
    > addresses).
    >
    > It works just fine on another domain host provider but I need to get it to
    > work
    > on this particular.
    >
    > What alternatives can I try?


    Look in the log files for mail on your web site provider. See if mail is
    actually being sent out by the perl script. If it is, then the perl
    works. What's happening once it leaves the machine is anyone's
    guess--spam filter or blocker or maybe someone doesn't like you.

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...
    [I filter all Goggle Groups posts, so any reply may be automatically ignored]
    Michael Vilain, Oct 13, 2013
    #2
    1. Advertising

  3. John

    John Guest

    Michael Vilain <> wrote:

    >In article <>,
    > John <> wrote:
    >
    >> My web site provider has trouble getting sendmail to work.
    >>
    >> This is a trimmed down versio on a perl file that used to work just fine for
    >> years and then it quit working. I've contacted them to no avail:
    >>
    >>
    >> #!/usr/bin/perl
    >> print "Content-Type: text/html; charset=iso-8859-1\n\n";
    >> print '<html><head>';
    >> print '<meta http-equiv="Content-Type" content="text/html;
    >> charset=iso-8859-1">';
    >> print '</head><body>';
    >> $i=0;
    >> &testmail;
    >> print "Testing email $i <br>(1=success, 0=fail)<br>";
    >> print "</body></HTML>";
    >>
    >> sub testmail
    >> {
    >> #open(MAIL,"|/usr/sbin/sendmail -t") || return 0;
    >> open(MAIL,"|/usr/lib/sendmail -t") || return 0;
    >> #open(MAIL,"|/usr/bin/sendmail -t") || return 0;
    >> select (MAIL);
    >> print "To: blahblah\@whatever.com\n";
    >> print "From: blahblah\@whatever.com\n";
    >> print "Subject: testing\n";
    >> print "\n";
    >> print "This is message.\n";
    >> close(MAIL);
    >> select (STDOUT);
    >> $i=1;
    >> }
    >>
    >> The code returns:
    >>
    >> "Testing email 1
    >> (1=success, 0=fail)"
    >>
    >> but no email ever gets to the receiver (yes, I tried with actual working
    >> addresses).
    >>
    >> It works just fine on another domain host provider but I need to get it to
    >> work
    >> on this particular.
    >>
    >> What alternatives can I try?

    >
    >Look in the log files for mail on your web site provider. See if mail is
    >actually being sent out by the perl script. If it is, then the perl
    >works. What's happening once it leaves the machine is anyone's
    >guess--spam filter or blocker or maybe someone doesn't like you.



    I can't find any log files using FileZilla.
    John, Oct 13, 2013
    #3
  4. John <> writes:
    > My web site provider has trouble getting sendmail to work.
    >
    > This is a trimmed down versio on a perl file that used to work just fine for
    > years and then it quit working. I've contacted them to no avail:


    [...]

    > open(MAIL,"|/usr/lib/sendmail -t") || return 0;


    [...]

    If you can create files on this machine, you could make that something
    like

    open(MAIL, '| /usr/sbin/sendmail -tv >/tmp/sendmail 2>&1')

    This will put a trace of any SMP-conversation into /tmp/sendmail which
    might help with debugging this.
    Rainer Weikusat, Oct 13, 2013
    #4
  5. In article <>,
    John <> wrote:

    > Michael Vilain <> wrote:
    >
    > >In article <>,
    > > John <> wrote:
    > >
    > >> My web site provider has trouble getting sendmail to work.
    > >>
    > >> This is a trimmed down versio on a perl file that used to work just fine
    > >> for
    > >> years and then it quit working. I've contacted them to no avail:
    > >>
    > >>
    > >> #!/usr/bin/perl
    > >> print "Content-Type: text/html; charset=iso-8859-1\n\n";
    > >> print '<html><head>';
    > >> print '<meta http-equiv="Content-Type" content="text/html;
    > >> charset=iso-8859-1">';
    > >> print '</head><body>';
    > >> $i=0;
    > >> &testmail;
    > >> print "Testing email $i <br>(1=success, 0=fail)<br>";
    > >> print "</body></HTML>";
    > >>
    > >> sub testmail
    > >> {
    > >> #open(MAIL,"|/usr/sbin/sendmail -t") || return 0;
    > >> open(MAIL,"|/usr/lib/sendmail -t") || return 0;
    > >> #open(MAIL,"|/usr/bin/sendmail -t") || return 0;
    > >> select (MAIL);
    > >> print "To: blahblah\@whatever.com\n";
    > >> print "From: blahblah\@whatever.com\n";
    > >> print "Subject: testing\n";
    > >> print "\n";
    > >> print "This is message.\n";
    > >> close(MAIL);
    > >> select (STDOUT);
    > >> $i=1;
    > >> }
    > >>
    > >> The code returns:
    > >>
    > >> "Testing email 1
    > >> (1=success, 0=fail)"
    > >>
    > >> but no email ever gets to the receiver (yes, I tried with actual working
    > >> addresses).
    > >>
    > >> It works just fine on another domain host provider but I need to get it to
    > >> work
    > >> on this particular.
    > >>
    > >> What alternatives can I try?

    > >
    > >Look in the log files for mail on your web site provider. See if mail is
    > >actually being sent out by the perl script. If it is, then the perl
    > >works. What's happening once it leaves the machine is anyone's
    > >guess--spam filter or blocker or maybe someone doesn't like you.

    >
    >
    > I can't find any log files using FileZilla.


    The mail transfer agent is most likely a service that's managed by the
    web hosting company. You'll have to contact them for a copy, if they'll
    even provide it at all.

    If you're using a shared hosting facility, I'd look at moving your
    hosting to a VM instead. You'll have to manage everything, but you'll
    have more control over such things as email and the web server for your
    site. Your call on if it's worthwhile.

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...
    [I filter all Goggle Groups posts, so any reply may be automatically ignored]
    Michael Vilain, Oct 13, 2013
    #5
  6. John

    John Guest

    Rainer Weikusat <> wrote:

    >John <> writes:
    >> My web site provider has trouble getting sendmail to work.
    >>
    >> This is a trimmed down versio on a perl file that used to work just fine for
    >> years and then it quit working. I've contacted them to no avail:

    >
    >[...]
    >
    >> open(MAIL,"|/usr/lib/sendmail -t") || return 0;

    >
    >[...]
    >
    >If you can create files on this machine, you could make that something
    >like
    >
    >open(MAIL, '| /usr/sbin/sendmail -tv >/tmp/sendmail 2>&1')
    >
    >This will put a trace of any SMP-conversation into /tmp/sendmail which
    >might help with debugging this.



    I looked up the man page fro meaning on -tv but could not find explanation. What
    does -tv >/tmp/sendmail 2>&1

    I tried it and got no log file. I also tried
    $i3=open(MAIL,"|/usr/sbin/sendmail -tv >test.txt") || return 0;

    where $i3 gets a number but no test.txt is created.
    John, Oct 14, 2013
    #6
  7. In article <>,
    John <> wrote:

    > Rainer Weikusat <> wrote:
    >
    > >John <> writes:
    > >> My web site provider has trouble getting sendmail to work.
    > >>
    > >> This is a trimmed down versio on a perl file that used to work just fine
    > >> for
    > >> years and then it quit working. I've contacted them to no avail:

    > >
    > >[...]
    > >
    > >> open(MAIL,"|/usr/lib/sendmail -t") || return 0;

    > >
    > >[...]
    > >
    > >If you can create files on this machine, you could make that something
    > >like
    > >
    > >open(MAIL, '| /usr/sbin/sendmail -tv >/tmp/sendmail 2>&1')
    > >
    > >This will put a trace of any SMP-conversation into /tmp/sendmail which
    > >might help with debugging this.

    >
    >
    > I looked up the man page fro meaning on -tv but could not find explanation.
    > What
    > does -tv >/tmp/sendmail 2>&1
    >
    > I tried it and got no log file. I also tried
    > $i3=open(MAIL,"|/usr/sbin/sendmail -tv >test.txt") || return 0;
    >
    > where $i3 gets a number but no test.txt is created.


    http://www.sendmail.org/~ca/email/doc8.12/op-sh-3.html#sh-3

    will show you that true sendmail run with -tv will run it in test mode
    with VERBOSE logging out put to a file. Are you sure your web host is
    even running sendmail and not postfix or some other mail transfer agent?
    Just because the program is there doesn't mean it's setup. Does ps show
    it running?

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...
    [I filter all Goggle Groups posts, so any reply may be automatically ignored]
    Michael Vilain, Oct 14, 2013
    #7
  8. John <> writes:
    > Rainer Weikusat <> wrote:
    >>John <> writes:
    >>> My web site provider has trouble getting sendmail to work.
    >>>
    >>> This is a trimmed down versio on a perl file that used to work just fine for
    >>> years and then it quit working. I've contacted them to no avail:

    >>
    >>[...]
    >>
    >>> open(MAIL,"|/usr/lib/sendmail -t") || return 0;

    >>
    >>[...]
    >>
    >>If you can create files on this machine, you could make that something
    >>like
    >>
    >>open(MAIL, '| /usr/sbin/sendmail -tv >/tmp/sendmail 2>&1')
    >>
    >>This will put a trace of any SMP-conversation into /tmp/sendmail which
    >>might help with debugging this.

    >
    >
    > I looked up the man page fro meaning on -tv but could not find explanation. What
    > does -tv >/tmp/sendmail 2>&1


    That's really the same as -t -v.

    > I tried it and got no log file. I also tried
    > $i3=open(MAIL,"|/usr/sbin/sendmail -tv >test.txt") || return 0;
    >
    > where $i3 gets a number but no test.txt is created.


    Judgeing from your original posting, the sendmail binary you were
    invoking resided in /usr/lib and not /usr/sbin. 'No test.txt is created'
    suggests that your perl process is not allowed to create files in the
    directory in question. The return value of the open just tells you if
    forking a new process succeeded (it will then be the process ID of this
    process). Problems encountered by the shell while trying to execute the
    actual command _may_ manifest themselves in form of a non-zero $? after
    the handle has been closed.
    Rainer Weikusat, Oct 14, 2013
    #8
  9. John

    John Guest

    I got a log from TEST.TXT is below. Everything seems ok but no email ever get to
    any recipients (with valid email addresses not )

    ... Connecting to [127.0.0.1] via relay...
    220 weblah.blah.net ESMTP Sendmail 8.13.8/8.13.8; Tue, 15 Oct 2013 10:27:06 +0200
    >>> EHLO weblah.blah.net

    250-weblah.blah.net Hello localhost.blah.net [127.0.0.1], pleased to meet you
    250-ENHANCEDSTATUSCODES
    250-PIPELINING
    250-8BITMIME
    250-SIZE
    250-DSN
    250-ETRN
    250-DELIVERBY
    250 HELP
    >>> MAIL From:<> SIZE=85

    250 2.1.0 <>... Sender ok
    >>> RCPT To:<>
    >>> DATA

    250 2.1.5 <>... Recipient ok
    354 Enter mail, end with "." on a line by itself
    >>> .

    250 2.0.0 r9F8R6bG272952 Message accepted for delivery
    ... Sent (r9F8R6bG272952 Message accepted for delivery)
    Closing connection to [127.0.0.1]
    >>> QUIT

    221 2.0.0 weblah.blah.net closing connection
    John, Oct 15, 2013
    #9
  10. John <> writes:

    > I got a log from TEST.TXT is below. Everything seems ok but no email
    > ever get to any recipients (with valid email addresses not
    > )


    Yes, the log looks fine, but there are countless reasons why the mail
    does not get delivered once it's been accepted. Unless you have access
    to the mail system's log files, you probably can't do much more than
    keep complaining to the hosting company. In the end, you may well have
    to switch.

    <snip log>
    --
    Ben.
    Ben Bacarisse, Oct 15, 2013
    #10
    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,189
    Aaron Powell
    Jul 24, 2003
  2. DaveF
    Replies:
    5
    Views:
    378
    Mike Kruchten
    Apr 8, 2004
  3. sugapablo
    Replies:
    0
    Views:
    2,141
    sugapablo
    Sep 21, 2007
  4. Andrzej Adam Filip
    Replies:
    0
    Views:
    4,064
    Andrzej Adam Filip
    Mar 31, 2008
  5. Replies:
    3
    Views:
    115
    Randy Webb
    Jul 27, 2006
Loading...

Share This Page