LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-08-2006, 01:02 AM   #1
tzpow2k2
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?

#!/usr/bin/perl

use Mail::Sendmail;

%mail = ( To => 'someone@gmail.com',
From => 'me@mydomain.com',
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=<me@mydomain.com>, size=226, class=0, nrcpts=1, msgid=<200607080546.k685kDm9004049@localhost.localdomain>, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]

Jul 7 23:01:14 localhost sendmail[4051]: k685kDm9004049: to=<someone@gmail.com>, delay=00:15:00, xdelay=00:15:00, mailer=esmtp, pri=120226, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection timed out with gsmtp163.google.com.
 
Old 07-08-2006, 01:56 PM   #2
jonaskoelker
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:

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


In that way, it will get displayed in a fixed-with font, like this:
Code:
#!/usr/bin/perl -w
use strict;
print "hello, world\n";
# etc.
Secondly, the error is in your mail log:
Code:
stat=Deferred: Connection timed out with gsmtp163.google.com.
For some reason, you couldn't reach gsmtp163.google.com in time. Try runnig ping $HOST, traceroute $HOST, tcptraceroute $HOST, host $HOST and netcat $HOST 25 (with $HOST=gsmtp163.google.com, 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 (http://www.usenix.org/events/lisa04/tech/) 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!
 
  


Reply


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-09-2006 11:25 PM
email 'send' NO - email 'receive' YES..? captain skywave Linux - Wireless Networking 4 04-23-2005 03:35 AM
email 'send' YES - email 'receive' NO..? captain skywave Linux - Wireless Networking 1 04-22-2005 05:23 AM
Need to send email via C lucasbl3 Programming 3 02-25-2004 11:04 AM
Allowing an IP to send email using my email server... culprit Linux - Networking 7 09-09-2003 12:24 PM


All times are GMT -5. The time now is 08:34 AM.

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