Operating System - HP-UX
1832893 Members
2272 Online
110048 Solutions
New Discussion

For Rita Workman (sendmail)

 
SOLVED
Go to solution
Stefan Farrelly
Honored Contributor

For Rita Workman (sendmail)

A request for Rita.

Rita wrote:

Here's a thread that addresses a 'workaround' for sendmail to send a subject line:
http://us-support.external.hp.com/cki/bin/doc.pl/sid=b551b0eb0d495b49d7/screen=ckiDisplayDocument?docId=200000054887756

Now for another option. Have you thought of trying elm, which does have a -s "subject option". Elm uses the sendmail transport. Just a thought,
/rcw

Hi Rita,
For those of us without a US login clicking on the above link is a pain in the glorious maximus because now my browser continually tries to connect to the US site, instead of Europe, and it takes me 10 minutes of continually repointing back to the European site before my browser remembers to stay there. Instead of the above link can you please include the actual document here (in your reply).

Many thanks,

Stefan
Im from Palmerston North, New Zealand, but somehow ended up in London...
4 REPLIES 4
laurent pitoiset_1
Frequent Advisor
Solution

Re: For Rita Workman (sendmail)

Hi Stefan,

attached is a copy of the document you are looking for.

best regards,

Laurent
Forums admin
Stefan Farrelly
Honored Contributor

Re: For Rita Workman (sendmail)

Hi Laurent,

Your not Rita but thanks for the document. I wanted this document included in a reply (not as an attachment) so that in future someone can search the forums and find it easily, so ive included it below.

Cheers,

Stefan


Command-line mailing with subject, body text and attachments
DocId: KBAN00000679 Updated: 20010420
DOCUMENT
PROBLEM:

Customer wants to be able to create a script to email a binary file to a
distribution list, with a subject line so recipients can readily identify it,
and body text explaining what the attachment is and what to do with it. To do
that, they need a method of creating and sending such a message.

RESOLUTION:

The method involves assembling a message from two separate parts, consisting of
a header which contains the body text and of a uuencoded attachment, then
sending it using the "-t" sendmail flag, which causes sendmail to scan the
message body for such things as addresses and the subject.

The first part of the message is a header, which looks like this:

To:

Cc:

Bcc:

Subject:

Then beginning on this line, you write the body text you want to include.


As you can see, the customer could easily put together a template header file
with variables in key positions, so a script to create and send the messages
could just grab the template and substitute the necessary values for the
variables. It's not necessary to include bcc or cc lines if they're not going
to be used.

Creating the message, then, is a matter of appropriately modifying a copy of
the header, and writing it to a temporary file. Then uuencode the attachment
file and ">>" redirect it to the same temporary file. Now send the contents of
that temporary file to sendmail, using the "-t" flag.

For example, let's say you have a report that you always send to the same
people, always using the same body text and subject line. For that you could
create a fixed header file, called "header" in this example. To distribute the
report:

# cp header > /var/tmp/mailtemp
# uuencode /path/datafile datafile >> /var/tmp/mailtemp
# cat /var/tmp/mailtemp | sendmail -t
# rm /var/tmp/mailtemp

That's all. Because of the "-t" flag, sendmail will read the header for
addressing and subject information. Uuencoded files with a ".csv" suffix sent
in testing arrived at an Outlook client as attachments which called up Excel
just as they should, while the body text part of the header file arrived as
body text.

Aliases were mentioned above in the description of the header. This is part of
sendmail, and works whether you're sending mail using sendmail alone, or with
ELM or mail or mailx or any client using sendmail as a transport vehicle.
In /etc/mail there's a file called "aliases," and in it you can define both
individual aliases and mailing lists. The basic format can be seen by just
looking at the file or consulting the man page for aliases(5). To define a
list, you start the line with the alias for the list, then after a ":"
delimiter, list the addressees (full address or alias) separated by commas.
It's okay to add a space after the comma for clarity. All addresses have to be
on the same line as the alias for the list; a new line is taken as the end of
the list. Sendmail doesn't usually use the aliases file itself, though, but
rather "aliases.db," so after you're done editing the aliases file you have to
issue the command "newaliases" to re-read the aliases file and re-write the
aliases.db file.

Im from Palmerston North, New Zealand, but somehow ended up in London...
Rita C Workman
Honored Contributor

Re: For Rita Workman (sendmail)

Hi Stefan,

I did not realize the complication...
I shall endeavor to cut and past the answers in the future. Not only to address your problem, but also for those times when it's an HP doc and the other person doesn't have access to that.

Thank you for pointing this out to me (and hopefully anyone else reading this...)

Regards,
Rita
Stefan Farrelly
Honored Contributor

Re: For Rita Workman (sendmail)


Thanks Rita,

Cheers,

Stefan
Im from Palmerston North, New Zealand, but somehow ended up in London...