Many times you may want to sent a particular excerpt from a config file or run output from a program to your email for better parsing. The "sendmail" provides a handy way to do that quickly and you can follow the steps below:-
1. Install uuencode utility to encode the file as binary
***********
$sudo yum install -y sharutils
***********
2. Now if you try to use sendmail as "ec2-user", you will see a permissions issue as below:-
***********
$uuencode ~/testfile.txt | sendmail -s "test" test@example.com
sudo sudo uuencode ~/testfile.txt | sendmail -s "test" test@example.com
WARNING: RunAsUser for MSP ignored, check group ids (egid=500, want=51)
can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.
***********
3. You can sudo in a root and try the same command again
***********
# uuencode /home/ec2-user/testfile.txt | sendmail -s "test" test@example.com
#
***********
NOTE - you have to press "Ctrl-D" to have sendmail send the mail.
1. Install uuencode utility to encode the file as binary
***********
$sudo yum install -y sharutils
***********
2. Now if you try to use sendmail as "ec2-user", you will see a permissions issue as below:-
***********
$uuencode ~/testfile.txt | sendmail -s "test" test@example.com
sudo sudo uuencode ~/testfile.txt | sendmail -s "test" test@example.com
WARNING: RunAsUser for MSP ignored, check group ids (egid=500, want=51)
can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.
***********
3. You can sudo in a root and try the same command again
***********
# uuencode /home/ec2-user/testfile.txt | sendmail -s "test" test@example.com
#
***********
NOTE - you have to press "Ctrl-D" to have sendmail send the mail.
No comments:
Post a Comment