Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-04-2010, 04:22 AM
|
#1
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Rep:
|
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
|
|
|
10-04-2010, 04:44 AM
|
#2
|
Member
Registered: Dec 2008
Location: Germany/Poland
Distribution: CentOS / Debian / Solaris / RedHat
Posts: 266
Rep:
|
Have You tried "sendmail" ?
cheers
Dlugasxx
|
|
|
10-04-2010, 11:15 AM
|
#3
|
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905
Rep:
|
Quote:
Originally Posted by dlugasx
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.
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...
|
|
|
10-05-2010, 10:15 AM
|
#4
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
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
|
|
|
10-05-2010, 12:45 PM
|
#5
|
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905
Rep:
|
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:
and
Code:
/etc/init.d/postfix reload
Let us know what you find...
|
|
|
10-06-2010, 09:07 AM
|
#6
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
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
|
|
|
10-06-2010, 09:12 AM
|
#7
|
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905
Rep:
|
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.
|
|
|
10-07-2010, 05:32 AM
|
#8
|
Member
Registered: Oct 2010
Location: India
Posts: 89
Rep:
|
Dear Adrien,
Which Mail Servers you are Configured??? Sendmail or Postfix???
|
|
|
10-07-2010, 09:25 AM
|
#9
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
Quote:
Originally Posted by linuxrndblog
Which Mail Servers you are Configured??? Sendmail or Postfix???
|
Postfix
|
|
|
10-07-2010, 09:27 AM
|
#10
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 09:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|