mail format problems


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mail format problems
# 1  
Old 03-11-2004
Question mail format problems

Hi,

I have a script that runs off the cron and creates a report, carries out a few checks and then sends the info in a email (i'm using mailx).

To exectute the sending from the script all I do is,

cat $reportfile | mailx -s "The Subject" my.email@work.com


When I test running this script manually (not via the cron) the report appears as the content of the email not as an attachment. This is what I want.

When I run it in the cron the mail arrives with an attachment (this has the report) and the email contains messages about unsupported charecter set not suported by the Internet service.

How can running this from cron (same user) give different results to running from the command line?

HPUX
sh script.

Many thanks,
Neil Smilie
# 2  
Old 03-11-2004
it should not be an attachment at all. the contents will be the body of the email.

my guess is something is going wrong with the inital process and is sending it as an error attachment.

now what the error would be i have no clue.
# 3  
Old 03-11-2004
mailx reads initialization commands first from /usr/share/lib/mailx.rc and then from $HOME/.mailrc. But the second file can't be read if HOME is not set. Could your cron job have clobbered the HOME variable? cron will set HOME by default.
# 4  
Old 03-11-2004
but to give mailx an attachment you have to use uuencode to do that. mailx does not have any built in functions to handle sending attachments.

The only time i get attachments (when i do not specify to attach something) is when there was an error sending blah mail and it is rejected for somereason or another and the mail comes back to the user that sent it.
# 5  
Old 03-11-2004
The issue is that HP-UX does not use ascii by default for mail. So you need to feed a line like:
set charset=us-ascii
to mailx in one of those start up files. If this is not done, a non-ascii mail message goes out. And microsoft user agents freak out and deliver it as an attachment.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

2. UNIX for Dummies Questions & Answers

Problems using Unix mail command (2)

I recently generated myself the following error when attempting to use the Unix mail command: The flags you gave make no sense since you're not sending mail. There is a recent thread about this issue here in unix.com (with a title very much like this thread's title), but it was closed... (2 Replies)
Discussion started by: Clovis_Sangrail
2 Replies

3. UNIX for Dummies Questions & Answers

STDOUT redirect to file and format problems

Hi All, I am using centOS. When I try to redirect STDOUT to a file, it ends up in getting some funny characters. For example ... STDOUT of the command as follows. $ ls H3k27me3 H3k36me3 H3k4me1 H3k4me2 H3k4me3 H3k9ac H4k20me1 $ ls >test $ cat test ^ (1 Reply)
Discussion started by: Chulamakuri
1 Replies

4. UNIX for Dummies Questions & Answers

MTA problems; root gets no mail

Hello, I am afraid that I goofed up my mailing system. I have an Ubuntu 9.10 system $ uname -smor Linux 2.6.31-14-generic x86_64 GNU/Linux I am wanting to receive cron job mails. I noticed that cron jobs were trying to send mail to sendmail. I had installed ssmtp so I could send mail... (1 Reply)
Discussion started by: Narnie
1 Replies

5. UNIX for Advanced & Expert Users

Sendmail problems -- with sending mail

Hello, I am C. and I would like to send mail with Sendmail to my hotmail-account. But this doesn't work, the mail always returns in the file: /var/spool/mail/root. Probably there is something wrong with my SmartHost. I configured it like: define ( 'SMART_HOST','smtp.direct-adsl.be') -->... (1 Reply)
Discussion started by: caroline
1 Replies

6. UNIX for Advanced & Expert Users

Format problems with fields

The following output has a space as the Field Separator. I need: $1 Set the field width to 15 then zero-fill to the right. $6 Set the field width to 15 then zero-fill to the left. 01-10016 1000 MV010 20090708 12003 $NK0015101 01 01-100161 12000 MV070 20090708 12003 $NK0015201 01... (6 Replies)
Discussion started by: talk2pawee
6 Replies

7. UNIX for Advanced & Expert Users

mail problems SUNOS BOX

now, i need to send a file to an email address but i cant seem to find a place on the internet that tells me that specifically. sites i came across just happens to be beating aroung the bush too much. i'm running a SUNOS box 5.6. can someone please give me the proper syntax. either for mailx... (2 Replies)
Discussion started by: Terrible
2 Replies

8. Solaris

mail problems - how to send mail on solaris

Hello I am new user on solaris... I need to configure my solaris to be able to send mails... I know mailx command mailx -s hello address@address.com but I get an error... you have mail in /var/mail/root # hello... User unknown /dead.letter... Saved message in /dead.letter what... (10 Replies)
Discussion started by: amon
10 Replies

9. UNIX for Advanced & Expert Users

Problems sending Mail

Hello everybody I already read all the posts about "how to send email" but i dont find the solution, i need to send a mail via commands. Into the mail i need to attach a file.txt how can i do that? Thanx. Lestat (2 Replies)
Discussion started by: Lestat
2 Replies
Login or Register to Ask a Question