Sending mail as a differnt user

Tech Guy tek_guy at rediffmail.com
Fri Apr 8 14:34:18 UTC 2005


  Thanks Rick,
As u suggested sendmail works fine with -f option to send as a different user.
I need to attach a zip file and some messages in the body. I am not able to achieve this completely. I am using uuencode along with sendmail. I can receive the attachement with this command. 
" uuencode file.zip file.zip | sendmail -t to-user at mycompany.com " 

But I need to add some text message in the mail so if I give this command
 " uuencode file.zip file.zip | sendmail -t to-user at mycompany.com -oi <mailtext "

then I only receive the content of "mailtext"(file containing message body)  but not the zip file 

I appreciate if anyone can suggest me to send email with attachemnt as well as body msg thro sendmail.

Thanks,
TG



On Thu, 07 Apr 2005 Rick Stevens wrote :
>Tech Guy wrote:
>>Hello Everyone,
>>
>>I have a shell script that does some functions and finally sends the report through the command "mail" in the script itself. The script has to be run as root. The script works fine and we do receive emails with the report.
>>
>>But it sends the email as root. I want the mail to be sent as a different user ( might not have account on that system) say someuser at someadddress.com
>>
>>I want to know if its possible to change the from address to someuser other than root
>
>I'm assuming the script is a simple shell script, so "mail" invokes the
>standard "/bin/mail" program.  In that case, no, you can't spoof it,
>because mail always sets the sender address as the user who ran it.
>
>If, however, you modify the script so it uses sendmail instead, you can
>spoof it--but only if the user running the script is root.  You can use
>the "-f from-user at somedomain.com" option to sendmail:
>
>sendmail -f from-user at somedomain.com
>
>sendmail will expect the mail content to be fed to its stdin as mail
>would.  Note that this may cause messages such as:
>
>     ...root set sender to from-user at somedomain.com using -f
>
>to appear in /var/log/maillog.  Just wanted to warn you.
>----------------------------------------------------------------------
>- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
>- VitalStream, Inc.                       http://www.vitalstream.com -
>-                                                                    -
>-              Careful!  Ugly strikes 9 out of 10 people!            -
>----------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/redhat-install-list/attachments/20050408/f92fa985/attachment.htm>


More information about the Redhat-install-list mailing list