Solved

sendmail problem

Posted on 2002-05-27
9
333 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

813 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

19 Experts available now in Live!

Get 1:1 Help Now