LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-04-2010, 04:22 AM   #1
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Rep: Reputation: 0
mail command not working


Hi,
I have a Fedora server on which the mail command has ceased to work. It used to work up to a couple of days ago, but now the following line simply does not send any mail:
Code:
/bin/mail -s "logfile for cron" cron@example.com </var/log/cron-log
Interestingly the PHP mail () function is still working and I am still able to send and receive email using Postfix and Dovecot, but trying to send email from the command line simply does not work.

The problem is that I have no idea where to start to debug. I've looked into the maillog file, but I cannot see anything abnormal. Does anybody know where I should be looking?


Thanks,
Adrien
 
Old 10-04-2010, 04:44 AM   #2
dlugasx
Member
 
Registered: Dec 2008
Location: Germany/Poland
Distribution: CentOS / Debian / Solaris / RedHat
Posts: 266

Rep: Reputation: 19
Have You tried "sendmail" ?


cheers

Dlugasxx
 
Old 10-04-2010, 11:15 AM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Quote:
Originally Posted by dlugasx View Post
Have You tried "sendmail" ?


cheers

Dlugasxx
The problem here is not the MTA (Postfix) and there is no reason to use a less secure / complex daemon to troubleshoot. You can review the Postfix logs while you try and run the script manually:

Code:
 tail -n 50 /var/log/maillog
Also check that 'mail' package wasn't removed from Fedora by some strange reason.

Code:
which mail
Post some logs from Postfix while the script attempts to run the 'mail' command or try sending an email alone using 'mail' before you incorporate the command in a complex script. See if it works alone...
 
Old 10-05-2010, 10:15 AM   #4
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Hi dlugasx, Hi carlosinfl,
Thanks for your suggestions.

I've tried "which mail" and the recult was "/bin/mail".

I have also tried the following three testcases...
Code:
/bin/mail -s "test 1" cron@example.com </var/log/cron-log
mail -s "test 2" cron@example.com </var/log/cron-log
sendmail -s "test 3" cron@example.com </var/log/cron-log
...and here is what I got in the maillog:
Code:
Oct  5 15:12:05 example-web sendmail[16115]: o95FC5jk016115: from=root, size=1469, class=0, nrcpts=1, msgid=<201010051512.o95FC5jk016115@localhost6.localdomain6>, relay=root@localhost
Oct  5 15:12:05 example-web sendmail[16115]: o95FC5jk016115: to=cron@example.com, delay=00:00:00, mailer=relay, pri=31469, stat=queued
Oct  5 15:12:11 example-web sendmail[16117]: o95FCB0E016117: from=root, size=1469, class=0, nrcpts=1, msgid=<201010051512.o95FCB0E016117@localhost6.localdomain6>, relay=root@localhost
Oct  5 15:12:11 example-web sendmail[16117]: o95FCB0E016117: to=cron@example.com, delay=00:00:00, mailer=relay, pri=31469, stat=queued
Oct  5 15:12:17 example-web sendmail[16118]: o95FCHSM016118: from=root, size=1260, class=0, nrcpts=3, msgid=<201010051512.o95FCHSM016118@localhost6.localdomain6>, relay=root@localhost
Oct  5 15:12:17 example-web sendmail[16118]: o95FCHSM016118: to=3, delay=00:00:00, mailer=relay, pri=91260, stat=queued
Oct  5 15:12:17 example-web sendmail[16118]: o95FCHSM016118: to=test, delay=00:00:00, mailer=relay, pri=91260, stat=queued
Oct  5 15:12:17 example-web sendmail[16118]: o95FCHSM016118: to=cron@example.com, delay=00:00:00, mailer=relay, pri=91260, stat=queued
Unfortunately none of the three test emails arrived.
Any ideas?


Thanks,
Adrien
 
Old 10-05-2010, 12:45 PM   #5
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
This sounds dumb but can you check /etc/aliases & verify that which ever email account user you're checking is configured to receive email for 'root'?

Perhaps just running:

Code:
newaliases
and

Code:
/etc/init.d/postfix reload
Let us know what you find...
 
Old 10-06-2010, 09:07 AM   #6
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Hi carlosinfl,
I've tried sending the email to an external account and have tried reloading postfix, but neither seems to be doing the trick or giving any clue as to why it's not working. Thanks for your help!



Adrien
 
Old 10-06-2010, 09:12 AM   #7
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Your DNS looks very weird from your logs. First off I want to make sure that you're using Postfix, not Sendmail, right? Second, lets look at your machine's FQDN by posting the results of:

Code:
[carlos@tuna ~]$ hostname -f
tuna.iamghost.com
Let's make sure your mail server knows what it it's own name is. Then we should look at your Postfix configuration file. Can you paste the output of 'postconf -n' command here. You can omit any IP or information you don't want public.
 
Old 10-07-2010, 05:32 AM   #8
linuxrndblog
Member
 
Registered: Oct 2010
Location: India
Posts: 89

Rep: Reputation: 2
Dear Adrien,

Which Mail Servers you are Configured??? Sendmail or Postfix???
 
Old 10-07-2010, 09:25 AM   #9
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linuxrndblog View Post
Which Mail Servers you are Configured??? Sendmail or Postfix???
Postfix
 
Old 10-07-2010, 09:27 AM   #10
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Hi carlosinfl,
The reply of hostname -f is example-web, while the Postfix configuration file is:

Quote:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
disable_vrfy_command = yes
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
invalid_hostname_reject_code = 450
local_transport = virtual
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maps_rbl_reject_code = 450
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = example.com
myhostname = mail.example.com
mynetworks = $config_directory/mynetworks
mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
non_fqdn_reject_code = 450
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.5.5/README_FILES
sample_directory = /usr/share/doc/postfix-2.5.5/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_tls_CAfile = /etc/pki/tls/certs/example_com.ca-bundle
smtp_tls_cert_file = /etc/pki/tls/certs/example_com.crt
smtp_tls_key_file = /etc/pki/tls/private/myserver.key
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/pki/tls/certs/example_com.ca-bundle
smtpd_tls_ask_ccert = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/example_com.crt
smtpd_tls_key_file = /etc/pki/tls/private/myserver.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:12
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 101
virtual_uid_maps = static:101
Thanks,
Adrien
 
  


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
'mail' command not working in cyrus environment Sanford Stein Linux - Newbie 2 05-01-2013 10:08 AM
mail command not working soroccoheaven Linux - Server 3 10-07-2010 05:38 AM
Debian etch - Unable to send mail from command line or from php mail command lqforumuser Linux - Newbie 1 03-01-2009 06:56 AM
can mail command be used to send mail onto global mail servers like yahoo etc dale_chip Linux - Newbie 4 08-12-2008 08:33 AM
Mail -s command not working appropriately dphe Linux - Software 3 01-09-2007 12:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:45 PM.

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
Open Source Consulting | Domain Registration