LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   /usr/bin/mail doent work (https://www.linuxquestions.org/questions/ubuntu-63/usr-bin-mail-doent-work-570911/)

rangalo 07-20-2007 07:57 AM

/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

ramram29 07-20-2007 08:51 AM

Change

/#!/bin/bash

to

#!/bin/bash

rangalo 07-20-2007 08:56 AM

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

AlucardZero 07-20-2007 01:52 PM

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))

rangalo 07-23-2007 03:03 AM

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

AlucardZero 07-23-2007 11:16 AM

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.

rangalo 07-24-2007 10:19 AM

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

AlucardZero 07-24-2007 12:06 PM

Ctrl+D sure works for me. (it then asks me for any CC: addresses). So I don't know what your problem is.

acascianelli 09-14-2007 08:53 AM

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.


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