in reply to Sendmail issue

Are you carrying your laptop to this other location, or are you executing the script from a different computer? If the former, then the first thing to investigate would be blocked outgoing SMTP, as the other monks have suggested.

Your open would be better with error handling: open(MAIL, "|/usr/sbin/sendmail -t") or die "Failed to open sendmail: $!"; and the same for your close: close MAIL or die $! ? "Error closing sendmail: $!" : "Exit status $? from sendmail";

Replies are listed 'Best First'.
Re^2: Sendmail issue
by arete (Initiate) on Aug 08, 2014 at 13:00 UTC
    I carry my laptop to other location, and the script works.

    Per your suggestion, I put the error handling and still do not see any error.

    Here is Sendmail log.

    Aug 8 08:59:00 MacBook.local postfix/smtp[15911]: warning: 30A5F1C79A +1F: defer service failure Aug 8 08:59:00 MacBook.local postfix/smtp[15911]: 30A5F1C79A1F: to=<s +oni.nimesh@gmail.com>, relay=none, delay=260447, delays=260356/0.06/9 +0/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.goog +le.com[74.125.136.26]:25: Operation timed out)

      This is not a Perl problem. It is a networking problem. SMTP is blocked to keep you or a trojan on your system from spamming from Comcast's IP ranges.

      Check to see if you can instead use the SMTP submission port (587) which is meant for new message submissions. That may be blocked as well.

      If you must use a local MTA (which you shouldn't need to do) then remember that SMTP is not a direct peer-to-peer protocol. It is a store and forward protocol that can use any number of servers along the path. The proper thing to do would be one of two options. You could connect to the proper designated outbound mail server and authenticate (using Net:SMTP, Net::SMTP::TLS, Mail::Sender, ...) to send mail through the ISP's server. You also could set up your mail server to smart forward and send to Comcast's server (agaiun, with authentication if you're sending to other than their recipients).

      I'm not going to give you a lot of free help on configuring your mail server, especially not on Perlmonks. You can totally make your program configurable to send through different servers and accounts as needed, though.

      By the way, if your other connection will allow any client machine open access to send SMTP traffic to anywhere in the world then that's a problem. Spam costs billions a year. Don't be a dirty spammer, and don't use companies that make being a dirty spammer easy.

        Thanks for the info. I will try Net::SMTP. And, no, I am not trying to spam anybody. I just want to send some log files to myself. I appreciate your concerns though.