Solved

sendmail problem

Posted on 2002-05-27
9
343 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

679 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