Solved

sendmail problem

Posted on 2002-05-27
9
324 Views
Last Modified: 2013-12-27
Why does Sendmail refuse to mail the text file and just send the header to the recipient when the script ends successfully, the text file is created, and all permissions to required directories are 777 ????
0
Comment
Question by:zeb
  • 4
  • 4
9 Comments
 
LVL 15

Expert Comment

by:samri
ID: 7038335
How does you scripts send the mail?  What is the cmd used.

Normally if you have a text file ready, the and the file would look like this;

/tmp/somefile.txt
-------------
To: user@remote.domain.com
Cc: ccuser@otherdomain.com
Bcc: somebody@somwehere.com
Subject: Whatever the subject

And the text
-----------------

do a "/usr/lib/sendmail -t /tmp/somefile.txt"

or you could "cat /tmp/somefile.txt | /usr/lib/sendmail"

Do you have any error in syslog?

regards,
0
 

Author Comment

by:zeb
ID: 7038733
how we're sending the mail is:

mail name@company.com < $LOG

$LOG being the email message that has been built...

syslog reports "message successfully accepted..."

it doesn't arrive or arrives blank

cheers
0
 
LVL 15

Expert Comment

by:samri
ID: 7038783
Im not sure how the mail command accept the redirection.

Maybe you might want to try

cat $LOG | mail name@company.com

2nd option.
/usr/lib/sendmail -t $LOG

But this format would require the recipient address to be in the file $LOG.

Some pointers:
http://www.linuxgazette.com/issue65/tag/26.html

OR some other options;

http://www.perlfect.com/articles/sendmail.shtml

Give the options a try.
0
 

Author Comment

by:zeb
ID: 7038875
check out the links and we don't actually have sendmail installed.. but used the cat $LOG line and it made little difference... emailed a batch of three emails twice, the first time 2 real messages came through. the second time only one of the messages came through. those messages that never came through were blank ones...

any ideas?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 15

Expert Comment

by:samri
ID: 7039159
Well, the $LOG is actually refer to a file, and definitely it is not an empty file?.

0
 

Author Comment

by:zeb
ID: 7039202
100% the actual file IS generated and is there.... but doesn't get sent
0
 
LVL 15

Expert Comment

by:samri
ID: 7039580
zeb,

if some of the messages did actually go thru, I would believe that your scripts are actually working.  at the moment, I would concentrace on the one that doesn't go thru.

Any similarities among those that doesn't go thru.

Try to use the actual filename instead of substitution via $LOG  I would have suspected that the var. substitution that is the problem.  

0
 
LVL 38

Accepted Solution

by:
yuzh earned 50 total points
ID: 7040722
What shell are you using?

  I use the following syntax in my script a lot of times
and it works:

  mail name@company.com < $LOG

  Can you tell me how do you define $LOG, put the following
debug statement in your script to see what happen:

  put the following line in the beggining of the script:
  set -x                 # we run scripte in debug mode

  put the following just before the
  "mail name@company.com < $LOG" statement

  echo " \$LOG = ${LOG}"

  Please tell me the value of $LOG






 

0
 

Author Comment

by:zeb
ID: 7184917
revisited this problem after a while and this works perfectly. Sorry for delay.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Expiration of TSM data 17 88
Best software for Unix commands in Windows cmd.exe? 18 96
Shell script errors 10 99
Java core in Solaris 10 1 234
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now