On 18/06/2008, at 9:00 PM, Pieter Verberne wrote:

On Tue, Jun 17, 2008 at 03:56:02PM -0500, Aaron W. Hsu wrote:
I was looking at mail(1) and wondering if there was any way to get
control over the other headers? I haven't checked the source yet, but I couldn't find any documentation on adjusting the from headers on a whim
in mail. I send mail to some people from differing addresses, and I'd
prefer to be able to do this easily in mail when I need to. I am find
with doing a little sendmail magic if that's what is required.
Unfortunately, the information I found on the web assumed a mail version
that had slightly more options than does the OpenBSD version.

Cool, are you still using mail(1):D We all use bloatware Mutt. It is
even GPL. Nah, Mutt is cool, but the license is a shame. Still, it does
suck less than all other MUA/ mail clients I think.

You might have a look at Heirloom mailx.
http://heirloom.sourceforge.net/mailx.html

 Pieter Verberne

Hey, what happened to use base?  8-)

http://undeadly.org/cgi?action=article&sid=20080607131856

I've RTFMd and looked at the source, and it looks pretty close ... see below.

As Pieter said, the Heirloom app does exactly what you are asking ...
"an option to set the From: address directly"

I'd still be interested in those links you talked about initially, to
see what/how things have been done elsewhere.

/usr/src/usr.bin/mail ...

collect.c --- where we decide how to deal with ~<something>

Around line 215 ...

               case 'h':
                        /*
                         * Grab a bunch of headers.
                         */
                        grabh(hp, GTO|GSUBJECT|GCC|GBCC);
                        goto cont;

grabh is defined in tty.c, around line 114 you see it dealing with To: (as an example)

        if (gflags & GTO) {
#ifndef TIOCSTI
                if (!ttyset && hp->h_to != NULL)
ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
#endif
                s = readtty("To: ", detract(hp->h_to, 0));
                if (s == NULL)
                        goto out;
                hp->h_to = extract(s, GTO);
        }

Intriguing looking smopts element ... send.c around line 374 ...

        namelist = unpack(hp->h_smopts, to);
        if (debug) {
                char **t;

                fputs("Sendmail arguments:", stdout);
                for (t = namelist; *t != NULL; t++)
                        printf(" \"%s\"", *t);
                putchar('\n');
                goto out;
        }

... and line 412 ...

                execv(cp, namelist);

So that executes sendmail with extra arguments ...

BUT, so far as I can see so far, those extra parameters are
NULL when using the interactive mode, otherwise taken from
the mail command line ...

Reply via email to