Bob Miller wrote,
>(
>    echo EHLO example.com
>    echo RCPT To: [EMAIL PROTECTED]
>    echo MAIL From: [EMAIL PROTECTED]
>    echo DATA
>    sed 's/^.$//' < a_file
>    echo '.'
>) | nc -q10 localhost smtp

The sed command should probably be

     sed 's/^\.$//' < a_file

instead.  Without the backslash, it matches, and blanks out, any line
consisting of exactly one arbitrary character.  What you want is to match
any line consisting of exactly one period.

Though actually, if memory serves, correct dot quoting goes more like
this:

     sed 's/^\.$/../' < a_file

or something like that.


But since the sender is running as root, the su method, as described by
Patrick, is probably the most transparent way to do it.

     su sender -c 'mail -s "subject" [EMAIL PROTECTED] < message_file'

Of course this only works if "sendinguser" is a real user on your machine.
If you want the mail to appear to be from a nonexistant user (a mail
alias, for example), lower-level access is necessary, such as Bob's
SMTP example quoted above, or you can call your mail agent directly...if
you're using sendmail, it looks something like this:

     ( echo "From: [EMAIL PROTECTED]"
       echo "To: [EMAIL PROTECTED]"
       echo "Subject: Foo bar baz"
       echo
       cat message_file
     ) | sendmail -i -fsender [EMAIL PROTECTED]

               - Neil Parker
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to