Operating System - HP-UX
1753835 Members
7251 Online
108806 Solutions
New Discussion юеВ

outbound email works interactively ONLY

 
Steve Post
Trusted Contributor

outbound email works interactively ONLY

I have a simple text file.
It has to:, from:, subject: and even context-type: in it.
I run this command.....
cat ./myfile | /usr/bin/sendmail -oi -t

It sends the email to my pager immediately. No problems. Everythings is great.

Then I implement the change and retest. The message goes out, but never gets to the pager.

I make the script save a copy of the exact thing I send out and run this again
cat ./the_exact_data | /usr/sbin/sendmail -oi -t. It works perfectly.

In summary. If I watch it, it works. If I test it, it works. I can't get it to fail until I implement it. THEN it fails every time.

The one and only difference I can find.....
When I run it interactively it is INTERACTIVE. This means, "who am i" shows a userid (and it is root), a terminal, a login time. I'm a user on a computer.
NON-interactive is a job run by root still, but has no tty.

A bit more detail......
hpux11.23.
DS and DM set are set.
I never get inbound email.
I always send outbound email to a windows exchange server that forwards my stuff on out.


PS: I have a similar problem with the light in my refrigerator. Every time I check, that light is on. But as soon as I close the door, that light goes out.

7 REPLIES 7
Todd McDaniel_1
Honored Contributor

Re: outbound email works interactively ONLY

well first of all I would use the full path to the file.

Second, I would validate the ownership of that and which user is executing the job.

What does your mail.log say? is the file being sent out of the host or queued?

What do you mean by "Implement it"?
Unix, the other white meat.
Steve Post
Trusted Contributor

Re: outbound email works interactively ONLY

I wasn't putting the full path in because I was being generic. I have been watching the mail.log file. It shows the message going out to my bad pager every time.

I bet that there is something in how the message is created that is making the pager company throw it out as spam.

If you really want details,
It is the Data Protector 5.5 mount utility at /opt/omni/lbin/Mount.sh.

And I am also sending the message to my desktop email address. It is getting there each and every time. And I also am getting the message to a different type of pager each and every time.

Instead of forcing my pager company to modify their email policies to an unspecified change, I want to find and fix the cause. It's my hope that the problem is very obvious. (well.... at least to somebody that's not me).
Steve Post
Trusted Contributor

Re: outbound email works interactively ONLY

What do I mean by interactive?
cd /opt/omni/lbin
cp -p Mount.sh Mount.sh.SAVE
vi Mount.sh
replace its contents with.....
TMPFILE=/tmp/emailtest.${$}
DSUFFIX=`/usr/bin/date +"%d%b%Y %H%M"`
echo "From: dp51@mybox" >> $TMPFILE
echo "To: postpager, postdesk" >> $TMPFILE
echo "Subject: need tape for yadda yadda" >> $TMPFILE
echo "Context-Type: text" >> $TMPFILE
echo " " >> $TMPFILE
echo "this is a test" >> $TMPFILE
/usr/bin/date +"%d%b%Y %H%M" >> $TMPFILE
echo "whoami `whoami` who am i `who am i`" >> $TMPFILE
env >> $TMPFILE
echo "this is the END." >> $TMPFILE
cat $TMPFILE | /usr/sbin/sendmail -t -oi
#rm $TMPFILE
mv $TMPFILE /tmp/steve.dp51.test.txt

Interactive.... /opt/omni/lbin/Mount.sh
Non-interactive.... I request a restore from a tape that is not in the tape slot and I wait for /opt/omni/lbin/Mount.sh to run.
It DOES run. It DOES send me an email to my pc. It does NOT get to the pager.
Steven Schweda
Honored Contributor

Re: outbound email works interactively ONLY

> It DOES send me an email to my pc. It does
> NOT get to the pager.

So, it doesn't sound like a problem sending
e-mail, or a difference between interactive
and non-interactive anything (whatever that
means).

Is there a limit on the size of a message you
can send to the pager? (And are you
exceeding it?)
Steve Post
Trusted Contributor

Re: outbound email works interactively ONLY

I know it IS a problem between interactive and non-interactive. I'm looking for the help on the answer. and the question is a problem?

What's the title of my forum entry anyhow?

I'm going back to a generic explanation of the problem.


Interactive.............................
From the unix shell prompt, I run: /application/program.sh

I get my page. I see my page. I read my page. My page is there. I also get my email.

NON-Interactive...........................
From the application, I setup a scenario where the application runs /application/program.sh on its own.

I do not get my page. I do not see my page. I do not read my page. My page is not there. I still get my email.

The length of the page? Since I am getting it on the interactive tests. The length of the page is inmaterial.

one more obvious thing.... I send a page to 2343434343434@pagingcompany.com. I am not using a modem.

Steve Post
Trusted Contributor

Re: outbound email works interactively ONLY

I found the solution. I found it in my own notes from Aug2005. It's a good thing to keep notes.

In /etc/mail/sendmail.cf, I am using the
DM - Domain Maquerade line.
And
DS - Domain Server line.

The DS line tells mail to send all outbound email to a different server that processes the mail.

The DM line replaces the from user@hostname.com to be from user@mycompany.com. This works great. When I am logged in as myself. And it works when I am root too. But I su'd to root and unix knows that. When the application runs, root is sending the mail as root@myhost. And it does NOT change to root@mycompany.com.

The key to the solution is in line "CE root" in sendmail.cf. This line essentially says "if root is sending mail, do NOT change myhost to mycompany.com. I had to change the line
from: CE root
to: CE

This fixed it. The system knows to replace root@myhost with root@mycompany.com, even it is user root.
A. Clay Stephenson
Acclaimed Contributor

Re: outbound email works interactively ONLY

I think that your problem is related to the -oi (interactive) sendmail argument rather than -ob (background). In this case, not being in an interactive environment might be your problem. Typically I don't use sendmail directly but instead rely upon mailx or elm to process the input, along with possible attachments, and send the output to sendmail.
If it ain't broke, I can fix that.