email - How to add X-header to unix mailx or add attachment to usr/sbin/sendmail -


i attempting add x-header x-app-volt: yes header of email .tar attachment. have access usr/sbin/sendmail , mailx. not have root access can't download other versions of mailx or mutt.

i can add x-header usr/sbin/sendmail using below code, can't figure out how add .tar attachment.

/usr/sbin/sendmail -i -- toemail << end to: toemail subject: test x-app-volt: yes  hope works! end 

i can attach .tar file mailx using the below code, can't figure out how add x-header. mailx not have -a option.

cat file | uuencode filename | mailx -s "test" toemail 

thank you

one way construct input in temporary file:

cat > tmpfile$$ << end to: toemail subject: test x-app-volt: yes  hope works!  end  uuencode filename < file >> tmpfile$$  /usr/sbin/sendmail -i -- toemail < tmpfile$$ 

also, use sendmail's -t flag in case, rather repeating recipient:

/usr/sbin/sendmail -i -t < tmpfile$$ 

if don't want use temporary file, if want use pure pipeline, can use ( ) create subshell construction:

( echo "to: toemail" echo "subject: test" echo "x-app-volt: yes" echo echo "hope works!" echo uuencode filename < file ) | /usr/sbin/sendmail -i -t 

(of course, these days recipients find easier deal mime attachments rather uuencode. it's pretty straightforward create mime attachments shell script, also.)


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -