UNIX mail blank in the TO address

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users UNIX mail blank in the TO address
# 1  
Old 11-21-2013
UNIX mail blank in the TO address

Hi All,

Can we send a mail in unix blank in TO address with CC and BCC.
TO address should be blank
CC should not be blank
BCC should not be blank

# 2  
Old 11-21-2013
Use sendmail, specify just CC & BCC:
        print "CC: user@domain.com"
        print "BCC: user@domain.com"
        print "Subject: Testing CC & BCC"
        print "Testing CC & BCC"
} | /usr/sbin/sendmail -t

Last edited by Yoda; 11-21-2013 at 01:39 PM.. Reason: Edit link to unix.com manual page
# 3  
Old 11-21-2013
I am using the below function and parameters
Here $c is TO address and $d is CC. But whenever ther is null in $c it is taking $d as in TO address.
My requirement is if there is null in $c then there should be no one in TO address and $d should be in CC.


# 4  
Old 11-21-2013
Can you post what exactly you are doing inside this function?
# 5  
Old 11-21-2013
function notify_users_Weekly
mailx -s """$subject""" """$address""" -c """$CCaddress"""< $contents >> RC=$?
return $RC

Last edited by Neo; 11-21-2013 at 01:33 PM.. Reason: Neo: Added code tags.
# 6  
Old 11-21-2013
Please use code tags for posting code fragments or data samples.

I guess in mailx, primary recipient address is not an optional argument. You do have to specify it.

So why don't you use sendmail instead which can deliver email without a primary recipient?

Moderator's Comments:
Mod Comment Please post links to man pages from our site. Thanks.

Last edited by Neo; 11-21-2013 at 01:33 PM.. Reason: Neo: Changed link to man page in post.
# 7  
Old 11-21-2013
Yoda is right. Try something more basic than mailx.
Perhaps mail is more basic.
But if your system has sendmail, go for it!
More customized for your needs
echo "\
Subject: $subject
Cc: $CCaddress

" | sendmail $address

NB: there must be an empty line between mail header and mail body.
The sendmail program might hide in /usr/lib/
And if you want a To: line, just add it to the mail header!
mailx and perhaps mail automatically place $address (the envelope) in a To: line,
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

How to send mail with sender mail address and name?

Hi, I am trying to send a mail using "mail" command in unix. I wanted to give sender name and sender address. I tried different options ,but still it shows only mail address(No name). mail -s "Alert mail : Nothing running !!!" $email -- -F"Mail Alert" -fno-reply@alert.com But I am getting... (4 Replies)
Discussion started by: jaggy
4 Replies

2. Shell Programming and Scripting

mail using mail address in a file

I have a file which contains few email address. I have few scripts which use the same mail address. so if any change in mail id like if any user do not want to receive the mail i can just edit a single file instead of many scripts. So i want the scripts to use that file. How can this be done. (2 Replies)
Discussion started by: gpk_newbie
2 Replies

3. Shell Programming and Scripting

Mail with From Address

hello all When i send an email using "mail" command, it is received by intended receiver but From Adress is getting displayed as user@hostname. Is there any way to change the From address of Email to xxx@bbb.com? Apprecite your response (2 Replies)
Discussion started by: forums123456
2 Replies

4. Shell Programming and Scripting

UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)

Hi folks I need to write UNIX script (with ldapsearch) to query Active Directory. Input is NT login name and output is Email address. Attached a screenshot of Sysinternals "AD Explorer". I need to do the same in CLI. http://i.imgur.com/4s6FB.png I am absolute LDAP/ldapsearch noob. (0 Replies)
Discussion started by: slashdotweenie
0 Replies

5. Shell Programming and Scripting

Unix mail with blank line on variable

I am testing a ksh script for email. In the subject/content of the mail there is some dynamic variables like date and charges. However these variables occupied the entire line erase other in that particular line For e.g. there is a mail message: This mail is intent... Your total... (2 Replies)
Discussion started by: balaji.rengaraj
2 Replies

6. Shell Programming and Scripting

Pull E-mail address from file, send e-mail

Hello, I am new to perl and need to create a script that will read a file and pull a name from the file and send e-mail. How can I use the following awk statement in a perl script? grep UNIXadmins /root/mail.conf | awk '{ print $2}' and use the output to send a e-mail. Any help would... (1 Reply)
Discussion started by: DC Heard
1 Replies

7. HP-UX

Sending msg From Unix Server to an E-mail Address

Dear Brothers in Unix I would like to change some HP-UX settings in order that the system send a message to root it should be copied to my e-mail address in Microsoft Exchange Server. Please can you help me. Best Regards and thanks in advance Gege (2 Replies)
Discussion started by: cgege
2 Replies

8. AIX

Change sender e-mail address

When sending emails to the outside world, aix present itself as d_prod@production1.pdc.itercom.org. This is causing some issue with our e-mail server. So we need to change the name to d_prod@itercom.org... Does any one know how this can be accomplished? Thank you (3 Replies)
Discussion started by: cchiang12
3 Replies

9. What is on Your Mind?

Tracing an e-mail address

Not sure if this is the right place to post this, but I thought I'd start here. Not really a Unix question, but I'm hoping the gurus here can help me in an area I know little about. Someone got one of my credit card numbers. Tried to use it to charge a bunch of stuff over the internet. The... (4 Replies)
Discussion started by: denverd0n
4 Replies
Login or Register to Ask a Question