sendmail problem

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 ????
zebAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
yuzhConnect With a Mentor Commented:
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
 
samriCommented:
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
 
zebAuthor Commented:
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
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
samriCommented:
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
 
zebAuthor Commented:
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
 
samriCommented:
Well, the $LOG is actually refer to a file, and definitely it is not an empty file?.

0
 
zebAuthor Commented:
100% the actual file IS generated and is there.... but doesn't get sent
0
 
samriCommented:
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
 
zebAuthor Commented:
revisited this problem after a while and this works perfectly. Sorry for delay.
0
All Courses

From novice to tech pro — start learning today.