|Mailx Sending mails with attachment. (Script)|
--------------------------
#!/bin/bash
#Date
DATE=`date |awk '{print $3"-"$2"-"$6}'`
#copy the file for attaching.
/usr/bin/cp /home/yourhome/etc/postfix/tls_policy /tmp/tls_policy
#Here is your lines for attaching files with message body.
#`cat` file you need as a body of message. `uuencode` to attach and mailx to send.
(cat /etc/postfix/tls_plicy_report_mail
/opt/csw/bin/uuencode /tmp/tls_policy tls_policy.report
) | /usr/bin/mailx -s "Quarterly tls_policy Report dated $DATE" yourname@yourdomain.com
exit
####################################
#Where:
#+$ cat /etc/postfix/tls_policy_report_mail
#This is an automated email generated from POSTFIX server.
#Please find attached the tls_policy file from production for your compliance review.
#Regards,
#IT team.
#####################################
___________________________________________________
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.