# Problem with mail utility on linux

**URL:** <https://community.unix.com/t/problem-with-mail-utility-on-linux/308080>\
**Category:** Red Hat\
**Created:** [April 10, 2012, 5:22am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080 "2012-04-10T05:22:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shriashishpatil](https://community.unix.com/letter_avatar/shriashishpatil/32/5_5575768a8748004e209b776fc1b2916d.png) [@shriashishpatil](https://community.unix.com/u/shriashishpatil)\
**Post date:** [April 10, 2012, 5:22am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/1 "2012-04-10T05:22:49Z")

</div>

Hi,

I am facing problem with "mail" utility on redhat linux.

If I use ~c in a file and use that file as imput to mail, the mail is not sent to the adrress after ~c. Instead ~c apears in the mail content itself.

```nohighlight
$ mail a@mycompany.com < temp
$ cat temp
~c abc@mycompany.com
this is test mail
$

```

Now my mail content will be

```nohighlight
~c abc@mycompany.com
this is test mail

```

Any help how I can use ~c using mail?  
On solaris/HP I use mailx to achieve same functionality.  
My sysadmin told that mailx is not availble in linux. When he installed mailx package, mail got installed.

thanks,  
Ashish

---

<div class="post-metadata">

**Author:** ![vipinkumarr89](https://community.unix.com/user_avatar/community.unix.com/vipinkumarr89/32/2589_2.png) [@vipinkumarr89](https://community.unix.com/u/vipinkumarr89)\
**Post date:** [April 10, 2012, 6:10am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/2 "2012-04-10T06:10:30Z")

</div>

you should use

```nohighlight
mail -v user@company.com

```

---

<div class="post-metadata">

**Author:** ![Scrutinizer](https://community.unix.com/user_avatar/community.unix.com/scrutinizer/32/1216_2.png) [@Scrutinizer](https://community.unix.com/u/Scrutinizer)\
**Post date:** [April 10, 2012, 7:11am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/6 "2012-04-10T07:11:35Z")

</div>

Some mail programs, have a special option, like `-l` or `-~` to allow for tilde-escapes during non-interactive use. Check your man page..

---

<div class="post-metadata">

**Author:** ![itkamaraj](https://community.unix.com/user_avatar/community.unix.com/itkamaraj/32/1880_2.png) [@itkamaraj](https://community.unix.com/u/itkamaraj)\
**Post date:** [April 10, 2012, 7:18am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/7 "2012-04-10T07:18:35Z")

</div>

```nohighlight
 
mail abc@xyz.com <<EOF
~s Subject of this email
~c abc@xyz.com
 
This is the subject
EOF

```

---

<div class="post-metadata">

**Author:** ![Scrutinizer](https://community.unix.com/user_avatar/community.unix.com/scrutinizer/32/1216_2.png) [@Scrutinizer](https://community.unix.com/u/Scrutinizer)\
**Post date:** [April 10, 2012, 11:11am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/9 "2012-04-10T11:11:33Z")

</div>

This post has been hidden from public view by a moderator.

Yes he is the one we were discussing.. I made another observation here: [http://www.unix.com/red-hat/181983-nis-server.html\#post302621347](http://www.unix.com/red-hat/181983-nis-server.html%5C#post302621347)

---

<div class="post-metadata">

**Author:** ![shriashishpatil](https://community.unix.com/letter_avatar/shriashishpatil/32/5_5575768a8748004e209b776fc1b2916d.png) [@shriashishpatil](https://community.unix.com/u/shriashishpatil)\
**Post date:** [April 12, 2012, 6:12am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/10 "2012-04-12T06:12:12Z")

</div>

Thanks itkamraj, scrutinizer for your reply.  
However it still does not work for me.  
I think my mail program is not recongizing ~s and ~c well.

In mail I am getting these characters with subject line and cc mail id as mail content.  
Any pointers?

thanks  
Ashish

---------- Post updated 04-12-12 at 03:42 PM ---------- Previous update was 04-11-12 at 03:54 PM ----------

The code put by itkamraj does not work for me.

Can somebody please try it on redhat linux and see it works.

I think I am missing something that my mail program is not recongnizing escape ~.  
I tried setting it in .mailrc in my home directory but it didn't help.

Any help?

-Ashish

---

<div class="post-metadata">

**Author:** ![shriashishpatil](https://community.unix.com/letter_avatar/shriashishpatil/32/5_5575768a8748004e209b776fc1b2916d.png) [@shriashishpatil](https://community.unix.com/u/shriashishpatil)\
**Post date:** [April 16, 2012, 7:05am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/11 "2012-04-16T07:05:15Z")

</div>

Anyone, could you please help?

---

<div class="post-metadata">

**Author:** ![shriashishpatil](https://community.unix.com/letter_avatar/shriashishpatil/32/5_5575768a8748004e209b776fc1b2916d.png) [@shriashishpatil](https://community.unix.com/u/shriashishpatil)\
**Post date:** [April 19, 2012, 1:16am UTC](https://community.unix.com/t/problem-with-mail-utility-on-linux/308080/12 "2012-04-19T01:16:57Z")

</div>

I got this done using -I option will mail on linux.

-I option forces mail to act interactively.

> [@](#):
>
> mail -I [abc@xyz.com](mailto:abc@xyz.com) \<\<EOF  
> ~s Subject of this email  
> ~c [abc@xyz.com](mailto:abc@xyz.com)
> 
> This is the subject  
> EOF

The redhat linux I use is 5.6.
