Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

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 ????
0
zeb
Asked:
zeb
  • 4
  • 4
1 Solution
 
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
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
yuzhCommented:
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
 
zebAuthor Commented:
revisited this problem after a while and this works perfectly. Sorry for delay.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now