Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-08-2006, 02:02 AM   #1
LQ Newbie
Registered: Jun 2006
Posts: 23

Rep: Reputation: 15
Why can't I send email

I hope this is the right place to post. I am trying to send email using perl, but I have no luck. Here is the code that I use. I checked the mail log and there is no error. The email just don't send through. Do I need to configure anything in Linux or Perl?


use Mail::Sendmail;

%mail = ( To => '',
From => '',
Message => "This is a very short message"

sendmail(%mail) or die $Mail::Sendmail::error;
print "OK. Log says:\n", $Mail::Sendmail::log;

**********mail log*****************
Jul 7 22:46:14 localhost sendmail[4049]: k685kDm9004049: from=<>, size=226, class=0, nrcpts=1, msgid=<200607080546.k685kDm9004049@localhost.localdomain>, proto=SMTP, daemon=MTA, relay=localhost.localdomain []

Jul 7 23:01:14 localhost sendmail[4051]: k685kDm9004049: to=<>, delay=00:15:00, xdelay=00:15:00, mailer=esmtp, pri=120226, [], dsn=4.0.0, stat=Deferred: Connection timed out with
Old 07-08-2006, 02:56 PM   #2
Senior Member
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Firstly, please put your code in code tags, like this:

#!/usr/bin/perl -w
use strict;
print "hello, world\n";
# etc.

In that way, it will get displayed in a fixed-with font, like this:
#!/usr/bin/perl -w
use strict;
print "hello, world\n";
# etc.
Secondly, the error is in your mail log:
stat=Deferred: Connection timed out with
For some reason, you couldn't reach in time. Try runnig ping $HOST, traceroute $HOST, tcptraceroute $HOST, host $HOST and netcat $HOST 25 (with $, or the proper entry into what I assume is a load-balancer).

If you know SMTP, try sending a message to yourself "manually" (netcat $HOST 25 might come in handy). Does the problem still happen? It might have been that google uses random load balancing and picked a crashed, hung or overloaded server for you.

Listen to the talk about debugging and sex therapy from LISA ( if you've got the time. I really doubt it's sendmail's fault, but if nothing works try installing a different MTA or two.

Best of luck!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't send email schawkeye Linux - Software 3 06-10-2006 12:25 AM
email 'send' NO - email 'receive' YES..? captain skywave Linux - Wireless Networking 4 04-23-2005 04:35 AM
email 'send' YES - email 'receive' NO..? captain skywave Linux - Wireless Networking 1 04-22-2005 06:23 AM
Need to send email via C lucasbl3 Programming 3 02-25-2004 12:04 PM
Allowing an IP to send email using my email server... culprit Linux - Networking 7 09-09-2003 01:24 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration