Reputation: 1729
I'm trying to send an email as below from unix environment.once i enter the command it does nothing and i have to kill the process manually.am i missing something here? i believe body is optional.
mail -s "Testing" [email protected]
Upvotes: 1
Views: 3394
Reputation: 881113
Yes, it will appear to do nothing, it's waiting for you to type in the body of the email before sending it.
From the BSD mail
man page (though they're all pretty similar):
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 message, followed by a 'control-D' at the beginning of a line.
So simply use the end-of-file input sequence CTRL-D (rather than the CTRL-C break sequence) to end the input and send the email.
Alternatively, try:
echo '' | mail -x "Testing" [email protected]
or:
mail -x "Testing" [email protected] </dev/null
where the two methods of providing empty input effectively do the same thing, without you having to type anything.
Upvotes: 2