LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 07-20-2007, 07:57 AM   #1
rangalo
Member
 
Registered: Jan 2005
Posts: 189

Rep: Reputation: 30
/usr/bin/mail doent work


Hi guys,

I am new to ubuntu. I just installed kubuntu 7.04 on my workstation at work.

I installed sendmail and mailutils, to be able to send mails from command-line and also from scripts.

I have following script set in my crontab which doesnt work now.

Even from command line, the /usr/bin/mail program doesn't work. It hangs for ever.

Code:
/#!/bin/bash

RECEPIENT="e.mail@gmail.com"

mail -s "**Reminder: Time to write summary !" e.mail@gmail.com <<  EOF
Date: `date +"%F %T"`
EOF
any idea ?

regards,
Hardik

Last edited by rangalo; 07-20-2007 at 07:59 AM.
 
Old 07-20-2007, 08:51 AM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
Change

/#!/bin/bash

to

#!/bin/bash
 
Old 07-20-2007, 08:56 AM   #3
rangalo
Member
 
Registered: Jan 2005
Posts: 189

Original Poster
Rep: Reputation: 30
hi,

Thanks for pointing out. It was just a typo occurred when I tried to paste it. In the original script it is not there. The script was working till yesterday perfectly well on the same system. Today, I executed dist-upgrade and firefox was upgraded. I think the problem has started after that. But, I fail to see any connection.

PS: As I already mentioned, the problem is not with the script. Running the mail (/usr/bin/mail) doesn't work either.

regards,
Hardik

Last edited by rangalo; 07-20-2007 at 08:58 AM.
 
Old 07-20-2007, 01:52 PM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Well what happens when you run the command manually?

Do try escaping the !. But also, you may be using it wrong. Here:
Code:
alucard@organa:~$ mail -s "**Reminder: Time to write summary \!" e.mail@gmail23353.com<ENTER>
testing  1 2 3<ENTER>
.<ENTER>
Cc:<ENTER>
And it tries to send (but bounces due to the fake address):
Jul 20 14:50:44 organa postfix/smtp[9652]: 912D140282: to=<e.mail@gmail23353.com>, relay=smtp.comcast.net[204.127.192.17]:25, delay=1.4, delays=0.08/0.08/1/0.19, dsn=5.0.0, status=bounced (host smtp.comcast.net[204.127.192.17] said: 550 [PERMFAIL] destination not valid within DNS (in reply to RCPT TO command))
 
Old 07-23-2007, 03:03 AM   #5
rangalo
Member
 
Registered: Jan 2005
Posts: 189

Original Poster
Rep: Reputation: 30
Hi,

Thanks for your reply.

Even if I try totally different subject, it delivers no mail. Here is the output I get when running manually from command line.

Code:
mail -s "subject" h.mehta@dresdner-cetelem.de
Cc: h.mehta@ctlm.de
lkfjd
lkjdfd
lkdjf

[2]+  Stopped                 mail -s "subject" h.mehta@dresdner-cetelem.de
I stopped it with ctrl+z which is generally the EOF character.

regards,
Hardik
 
Old 07-23-2007, 11:16 AM   #6
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
No, ctrl+D is the EOF character. Ctrl+z is the Background Process character.

Quote:
Originally Posted by man mail
Code:
   Sending mail
     To send a message to one or more people, mail can be invoked with arguments which are the
     names of people to whom the mail will be sent.  You are then expected to type in your mes-
     sage, followed by a control-D ('^D') at the beginning of a line.
You can also try ending your message with a period on its own line, as in my example.
 
Old 07-24-2007, 10:19 AM   #7
rangalo
Member
 
Registered: Jan 2005
Posts: 189

Original Poster
Rep: Reputation: 30
Hi,

Ctrl+D doesn't work. It doesn't react to it.

I also tried like this..

Code:
$mail -s "subject" e.mail@gmail.com << EOF
>lkdjfd
>ldkfjd
>dflkdjf
>EOF
And again, I get now response. The funny thing is the script called from the crontab now started working. But the command-line version doesn't work.

regards,
Hardik
 
Old 07-24-2007, 12:06 PM   #8
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Ctrl+D sure works for me. (it then asks me for any CC: addresses). So I don't know what your problem is.
 
Old 09-14-2007, 08:53 AM   #9
acascianelli
Member
 
Registered: Oct 2002
Location: Michigan
Posts: 71

Rep: Reputation: 15
Sorry to revive an old thread but I have a similar problem.

I'm trying to send an email from a script using the mail command and the email gets immediately delivered to the local mailbox and never goes out. I think its a problem with a configuration file, but I'm not sure how or where to configure.
 
  


Reply



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
FreeBSD 6.2, no /usr/src/tools and /usr/src/usr.bin, failed to build world. Mr_Shameless *BSD 4 05-16-2008 08:43 AM
what is difference between /usr/bin/7za /usr/bin/7z fakie_flip Linux - Software 9 08-14-2006 09:22 PM
Ubuntu 5.10 -> 6.06: diversion of /usr/bin/ldd to /usr/bin/ldd.amd64 by ia32-libs HellSpawn Linux - Software 2 06-04-2006 09:18 PM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM
/usr/bin/X11/ and /usr/X11R6/bin/ the same? linuxtesting2 Linux - Newbie 2 11-16-2004 10:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 03: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
Open Source Consulting | Domain Registration