sendmail script throwing an error "No recipient addresses found in header"

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sendmail script throwing an error "No recipient addresses found in header"
# 1  
Old 06-06-2011
sendmail script throwing an error "No recipient addresses found in header"


I am using following code to send an e-mail with attachment and body.

echo "To:," > mail.tmp
echo "Cc:," >> mail.tmp
echo "From:" >> mail.tmp
echo "Subject: my report" >> mail.tmp
echo "please see as attached" >> mail.tmp

uuencode /path/report.csv report.csv >> mail.tmp
cat mail.tmp | /usr/sbin/sendmail -t

But when I am executing it, its throwing me an error message saying "No recipient addresses found in header"

My OS details:
Linux 2.6.9-89.35.1.ELsmp #1 SMP Tue Jan 4 22:29:01 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

Can someone please help how I can fix this?

# 2  
Old 06-06-2011
Maybe it wants a space after the comma? Does it work for one address per line?
# 3  
Old 06-07-2011

Unfortunatly No...I tried with one e-mail account and its giving me the same error message.
# 4  
Old 06-07-2011
I seem to recall the order was "Received: ", "Date: ". "From:", "Subject: ", "To: ", in email files/streams I viewed. Maybe it is fussy.
# 5  
Old 06-07-2011
That also didnt work Smilie I tried with a different script

export MAILTO=""
export MAILCC=""
export FROM=""
export SUBJECT="My report"
export BODY="/path/matter.html"
export ATTACH="/path/report.csv"
 echo "From: $FROM"
 echo "To: $MAILTO"
 echo "Cc: $MAILCC"
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"'
 echo '---q1w2e3r4t5'
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 cat $BODY
 echo '---q1w2e3r4t5'
 echo 'Content-Type: application; name="'$(basename $ATTACH)'"'
 echo "Content-Transfer-Encoding: base64"
 echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
 uuencode --base64 $ATTACH $(basename $ATTACH)
 echo '---q1w2e3r4t5--'
) | /usr/sbin/sendmail -F $MAILTO -t $MAILCC

It works fine, but the only problem is body is missing whenever the e-mail is sent. Can you help?
# 6  
Old 06-07-2011
Maybe it uses blank lines like http to separate header from data?
MIME - Wikipedia, the free encyclopedia

Mime Fun Fact:

Although MIME was designed mainly for SMTP, the content types defined by MIME standards are also of importance in communication protocols outside of email, such as HTTP for the World Wide Web. Servers insert the MIME header at the beginning of any Web transmission. Clients use this content type or media type header to select an appropriate viewer application for the type of data the header indicates. Some of these viewers are built into the Web client or browser (for example, almost all browsers come with GIF and JPEG image viewers as well as the ability to handle HTML files).
# 7  
Old 06-08-2011
Well my first code worked when I changed the mail path to /tmp/mail.tmp

anyways thanks for your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Bash script fails with "function: not found" error

Hello everyone, I am having problems figuring this out. This script below is supposed to create a list of file names with their "md5sum", in a file "lib-list.txt" When I run it "sh " I get 4: function: not found (4 Replies)
Discussion started by: joemb
4 Replies

3. Red Hat

Could interrupt disabled cause "opreport error: No sample file found"?

Hi All I would like to profile my application with oprofile but I can't since no samples are collected. The kernel of my app is 2.6 on RED HAT Enterprise 5.3 (Tikanga) so OProfile is setup in timer interrupt mode # opcontrol --list-events Using timer interrupt. I... (0 Replies)
Discussion started by: manustone
0 Replies

4. UNIX for Advanced & Expert Users

Sendmail: how to restrict delivery based on "to" or "from"?

Hello, I manage a large sendmail server that handles more than 20,000 pieces of mail per day. It's a bit unusual in that all this mail is only being sent to and from 4 local accounts. (It's an automated transaction processing system, whereby users submit a transaction via email attachment). ... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies

5. UNIX for Dummies Questions & Answers

CRON JOB SCHEDULER throwing "option not allowed error"

Hi All, Pardon me if this turns out to be a dumb question. But I am trying to schedule a cron job for a my script which takes input options. So an entry in crontab would be something like: 1 * * * * -o out.csv -m monthly -e > cron_output.log 2> cron_error.log... (3 Replies)
Discussion started by: trueharsh
3 Replies

6. Red Hat

"No Drives Found" error during Redhat Linux AS 4 installation

I'm trying to install Redhat LInux AS 4 update 4 on an IBM x306 series server. I keep getting following error: "No Drives Found. An error has occurred - no valid devices were found on which to create new file systems. Please check your hardware for the cause of this problem." I called IBM and... (2 Replies)
Discussion started by: pieman8080
2 Replies

7. Shell Programming and Scripting

when executing .sh script in telnet error "script not found"

Hi. i have written a wrapper script which inturn call the ftp child script in it. Now the problem is when i executing the same script in my script directory through putty it is getting executed successfully;where as through telnet i get an error "scripts not found" Can some one help me... ... (1 Reply)
Discussion started by: smiley
1 Replies

8. Solaris

sendmail "root... User address required." error

I'm running sendmail (8.13.8+Sun/8.13.8/Submit) solaris 10. When I send mail to root at the command line (whether I use a full-qualified address or just root), I get the error message root... User address required. Sending mail to root (either at the command line or in a cron job),... (10 Replies)
Discussion started by: csgonan
10 Replies

9. Solaris

Network Path Not Found Error "Sunfire V100"

I recently got this new old server from a friend. I just installed a fresh version of Solaris 10 on it. I have put a static IP of the server. Their is no subnetting scheme on the network. And I made the hostname "SunServ." And I also changed the folder "/etc/inet/hosts" because I... (4 Replies)
Discussion started by: louisd11
4 Replies
Login or Register to Ask a Question