LinuxQuestions.org
Visit Jeremy's Blog.
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 06-24-2013, 04:28 PM   #1
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Rep: Reputation: 0
ubuntu server - how to diagnose not sending emails problem


hi,
i need to send myself email from command line once my backup script is finished.

i use the following command but i don't get any email :

mail -s "backup done" myemail@gmail.com

then shows cc:

i click ctrl D as i read somewhere

and the prompt is waiting forever ...
no email received in some hours.


how can i find the problem and fix it ?
thanks
Barnea
 
Old 06-25-2013, 12:45 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Can you do that again & copy/paste exactly what you did; that 'cc:' isn't std for cmd line mail tools.
Also, post
Code:
which mail

which mailx

mailq
Note also that (I believe) people like gmail, yahoo don't accept email from dynamic IPs because of the amt of spambots out there.
You'd need a registered hostname & email address, or go via your ISP's servers.
See similar threads/google.

Last edited by chrism01; 06-25-2013 at 12:47 AM.
 
Old 06-25-2013, 04:02 AM   #3
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
hi
thanks for your reply :

root@server:~# which mail
/usr/bin/mail
root@server:~# which mailx
/usr/bin/mailx
root@server:~# mailq
mailq: Mail queue is empty
 
Old 06-25-2013, 05:32 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
See the first pt in my post.
Try again to send a mail from the cmd line and show exactly (copy/paste) what happened.
Just before you start, open another terminal and
Code:
tail -f /var/log/maillog  # or whatever your mail logfile is
& post output also.
 
Old 06-26-2013, 01:36 AM   #5
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
See the first pt in my post.
Try again to send a mail from the cmd line and show exactly (copy/paste) what happened.
Just before you start, open another terminal and
Code:
tail -f /var/log/maillog  # or whatever your mail logfile is
& post output also.

root@server:~# mail -s "backup done" barnea10@gmail.com
Cc:
Null message body; hope that's ok

root@server:~#


2nd terminal

root@server:~# tail -f /var/log/mail.log
Jun 25 00:54:45 server sSMTP[12423]: Timeout on stdin while reading body
Jun 25 04:30:10 server sSMTP[12812]: Creating SSL connection to host
Jun 25 04:30:10 server sSMTP[12812]: SSL connection using RSA_ARCFOUR_SHA1
Jun 25 04:30:13 server sSMTP[12812]: Sent mail for root@gmail.com (221 2.0.0 closing connection p49sm32248100eeu.2 - gsmtp) uid=0 username=root outbytes=2925
Jun 26 05:03:38 server sSMTP[14672]: Creating SSL connection to host
Jun 26 05:03:40 server sSMTP[14672]: SSL connection using RSA_ARCFOUR_SHA1
Jun 26 05:03:44 server sSMTP[14672]: Sent mail for root@gmail.com (221 2.0.0 closing connection bj46sm39812123eeb.13 - gsmtp) uid=0 username=root outbytes=2371
Jun 26 09:00:50 server sSMTP[15092]: Creating SSL connection to host
Jun 26 09:00:51 server sSMTP[15092]: SSL connection using RSA_ARCFOUR_SHA1
Jun 26 09:00:55 server sSMTP[15092]: Sent mail for root@gmail.com (221 2.0.0 closing connection bj46sm40622944eeb.13 - gsmtp) uid=0 username=root outbytes=433
Jun 26 09:34:26 server sSMTP[15337]: Creating SSL connection to host
Jun 26 09:34:26 server sSMTP[15337]: SSL connection using RSA_ARCFOUR_SHA1
Jun 26 09:34:30 server sSMTP[15337]: Sent mail for root@gmail.com (221 2.0.0 closing connection n5sm40775404eed.9 - gsmtp) uid=0 username=root outbytes=377
 
Old 06-26-2013, 04:45 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Can you try using mailx instead of mail; not sure it will solve, but could be informative.
 
Old 06-27-2013, 12:26 AM   #7
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
Can you try using mailx instead of mail; not sure it will solve, but could be informative.
root@server:~# mailx -s "backup done" barnea10@gmail.com
Cc:


root@server:~# tail -f /var/log/mail.log
Jun 26 05:03:44 server sSMTP[14672]: Sent mail for root@gmail.com (221 2.0.0 closing connection bj46sm39812123eeb.13 - gsmtp) uid=0 username=root outbytes=2371
Jun 26 09:00:50 server sSMTP[15092]: Creating SSL connection to host
Jun 26 09:00:51 server sSMTP[15092]: SSL connection using RSA_ARCFOUR_SHA1
Jun 26 09:00:55 server sSMTP[15092]: Sent mail for root@gmail.com (221 2.0.0 closing connection bj46sm40622944eeb.13 - gsmtp) uid=0 username=root outbytes=433
Jun 26 09:34:26 server sSMTP[15337]: Creating SSL connection to host
Jun 26 09:34:26 server sSMTP[15337]: SSL connection using RSA_ARCFOUR_SHA1
Jun 26 09:34:30 server sSMTP[15337]: Sent mail for root@gmail.com (221 2.0.0 closing connection n5sm40775404eed.9 - gsmtp) uid=0 username=root outbytes=377
Jun 27 03:00:15 server sSMTP[16596]: Creating SSL connection to host
Jun 27 03:00:16 server sSMTP[16596]: SSL connection using RSA_ARCFOUR_SHA1
Jun 27 03:00:19 server sSMTP[16596]: Sent mail for root@gmail.com (221 2.0.0 closing connection cg12sm330121eeb.7 - gsmtp) uid=0 username=root outbytes=3065
Jun 27 08:24:55 server sSMTP[17343]: Creating SSL connection to host
Jun 27 08:24:56 server sSMTP[17343]: SSL connection using RSA_ARCFOUR_SHA1
Jun 27 08:25:00 server sSMTP[17343]: Sent mail for root@gmail.com (221 2.0.0 closing connection n5sm1501948eed.9 - gsmtp) uid=0 username=root outbytes=379
 
Old 06-27-2013, 03:21 AM   #8
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by barnea10 View Post
Sent mail for root@gmail.com
This is all kinds of wrong (unless, of course, you own gmail.com).
Fix your ssmtp.conf and/or /etc/mailname (or equivalent) to use a sensible from address.
 
Old 06-28-2013, 07:28 AM   #9
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
Can you try using mailx instead of mail; not sure it will solve, but could be informative.
using mailx did send mail but only after i got CC to enter and clicked ctrl + D

how to skip CC line and directly send the mail with mailx ?
 
Old 06-30-2013, 03:56 AM   #10
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
i try
mailx -s "backup 4 done" -c "barnea10@gmail.com" TO-LIST
which is wrong

running
mailx -s "backup 4 done" "barnea10@gmail.com"
gives a line of
CC:
waiting for input
but i have to get it automatic without further input

please advice

thanks
 
Old 07-01-2013, 12:05 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. See post #8; you don't own gmail.com, so that would be wrong.

2. I've never seen mail or mailx automatically ask for cc: etc; looks like they're aliased or symlinked to something else or defined as bash fns....
They're supposed to be simple cli tools.

You could check the locations ie
Code:
#check for alias
which mailx

# which gives me
/bin/mailx

#also check possible symlink
ll /bin/mailx
-rwxr-xr-x. 1 root root 391224 Aug 22  2010 /bin/mailx
If it looks good or you can find the one as per my system, try specifying the full path '/bin/mailx ...'.
 
Old 07-02-2013, 11:31 PM   #12
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
1. See post #8; you don't own gmail.com, so that would be wrong.

2. I've never seen mail or mailx automatically ask for cc: etc; looks like they're aliased or symlinked to something else or defined as bash fns....
They're supposed to be simple cli tools.

You could check the locations ie
Code:
#check for alias
which mailx

# which gives me
/bin/mailx

#also check possible symlink
ll /bin/mailx
-rwxr-xr-x. 1 root root 391224 Aug 22  2010 /bin/mailx
If it looks good or you can find the one as per my system, try specifying the full path '/bin/mailx ...'.
how to change the from email (root@gmail.com) ?
 
Old 07-03-2013, 03:43 AM   #13
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Cool help me install yum on ubuntu server

hi
need help to install yum on ubuntu server.
i try to run :
apt-get install yum

it doesn't succeed
and the output is :
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libpython2.6 librpm1 librpmbuild1 librpmio1 python-rpm python-sqlite
python-sqlitecachec python-urlgrabber python2.6 python2.6-minimal rpm
rpm-common rpm2cpio
Suggested packages:
python-sqlite-dbg python2.6-doc python2.6-profiler alien elfutils rpm-i18n
The following NEW packages will be installed:
libpython2.6 librpm1 librpmbuild1 librpmio1 python-rpm python-sqlite
python-sqlitecachec python-urlgrabber python2.6 python2.6-minimal rpm
rpm-common rpm2cpio yum
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,765 kB/6,436 kB of archives.
After this operation, 23.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
python2.6-minimal python2.6 libpython2.6 librpmio1 rpm-common librpm1
librpmbuild1 python-sqlite python-urlgrabber rpm2cpio rpm python-rpm
python-sqlitecachec yum
Install these packages without verification [y/N]? y
Err http://il.archive.ubuntu.com/ubuntu/ natty-updates/main python2.6-minimal amd64 2.6.6-6ubuntu7.1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main librpmio1 amd64 4.8.1-6ubuntu1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main rpm-common amd64 4.8.1-6ubuntu1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main librpm1 amd64 4.8.1-6ubuntu1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main librpmbuild1 amd64 4.8.1-6ubuntu1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/universe python-sqlite amd64 1.0.1-7ubuntu2
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main python-urlgrabber all 3.9.1-4
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main rpm2cpio amd64 4.8.1-6ubuntu1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/main rpm amd64 4.8.1-6ubuntu1
404 Not Found
Err http://il.archive.ubuntu.com/ubuntu/ natty/universe python-rpm amd64 4.8.1-6ubuntu1
404 Not Found
Err http://security.ubuntu.com/ubuntu/ natty-security/main python2.6-minimal amd64 2.6.6-6ubuntu7.1
404 Not Found [IP: 91.189.92.181 80]
Err http://security.ubuntu.com/ubuntu/ natty-security/main python2.6 amd64 2.6.6-6ubuntu7.1
404 Not Found [IP: 91.189.92.181 80]
Err http://security.ubuntu.com/ubuntu/ natty-security/main libpython2.6 amd64 2.6.6-6ubuntu7.1
404 Not Found [IP: 91.189.92.181 80]
Failed to fetch http://security.ubuntu.com/ubuntu/po...u7.1_amd64.deb 404 Not Found [IP: 91.189.92.181 80]
Failed to fetch http://security.ubuntu.com/ubuntu/po...u7.1_amd64.deb 404 Not Found [IP: 91.189.92.181 80]
Failed to fetch http://security.ubuntu.com/ubuntu/po...u7.1_amd64.deb 404 Not Found [IP: 91.189.92.181 80]
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu2_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/....9.1-4_all.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
Failed to fetch http://il.archive.ubuntu.com/ubuntu/...ntu1_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

and when running with --fix-missing :
Unable to correct missing packages.
E: Aborting install.

i think i need to locally download the yum package (rpm ?) and install it.

please advice to a newbie ...

thanks
 
Old 07-03-2013, 09:54 AM   #14
barnea10
LQ Newbie
 
Registered: Mar 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by barnea10 View Post
how to change the from email (root@gmail.com) ?
i found out that its ssmtp
how to remove it or disable ?
 
Old 07-03-2013, 09:57 PM   #15
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by barnea10 View Post
i found out that its ssmtp
how to remove it or disable ?
If you remove or disable it, then you won't be sending ANY email ...
Edit the ssmtp.conf to use a sane address.

Quote:
Originally Posted by barnea10 View Post
hi
need help to install yum on ubuntu server.
i try to run :
apt-get install yum
WTF?
 
  


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
Is someone sending emails through my sendmail server?? oscargim Linux - Server 2 06-19-2012 03:22 PM
email server not sending HTML emails decenttp Linux - Server 6 02-27-2012 06:32 AM
after upgrade to ubuntu 8.04 from 7.10 my cron is not sending emails eteck Linux - Server 1 08-26-2009 07:35 AM
How to know what emails server is sending? alsharifhoussam Linux - Server 1 05-21-2009 10:34 AM
somebody sending emails from my server proNick Linux - Newbie 10 02-25-2009 11:56 AM

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

All times are GMT -5. The time now is 06:17 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