0

Please see my below snippet, it is ignoring the attachment, only displaying the HTML content in the email body. I want to attach CSV file with it. Thanks in advance!!

awk -F ','  '
        BEGIN {

                print "From: xyz@gmail.com"
                print "To: abc@gmail.com"
                print "MIME-Version: 1.0"
                print "Content-Type: text/html"
                print "Subject: Weekly DM Row Count Sheet and Unmatched Data"
                print "<html><body><font face=verdana size=2 color=black ></br></br>Hi Team, </br>Please find the Weekly DM Row Count Sheet and Unmatched Data details. </br></br> <B> Row count is not matching for below tables. Please look into it.</b></br></br> "
                print "<table border=1 cellspacing=1 cellpadding=1 height="75">"
        }
        !/^#/ && /^S/ {
                print "<tr>"
                for ( i = 1; i <= NF; i++ )
                        print "<td> <center> <font face=verdana size=2> " $i " </center></td>"
                print "</tr>"
        }
        !/^#/ && !/^S/ {
                print "<tr>"
                for ( i = 1; i <= NF; i++ )
                        print "<td> <center> <font face=verdana size=2> " $i " </center></td>"
                print "</tr>"
        }
        END {
print "</table>" print "</br></br></b> Thanks & Regards</br> MS Support Team</br>"
print "</body></html>"
} ' NO_MATCH.csv | /usr/sbin/sendmail -t uuencode /root/ms_dba_admin/Scripts/PROMPT_AUDIT_ORDER/temp.csv
6
  • Related
    – Siva
    Jul 22 '19 at 13:29
  • Hi, I saw the related article, but that did not help. It is showing the code in email body and it is not attaching the file in email.
    – Varsha
    Jul 22 '19 at 13:31
  • it has an attachment file.zip
    – Siva
    Jul 22 '19 at 13:32
  • I am getting HTMLcode in the email body instead of an attachment.
    – Varsha
    Jul 22 '19 at 13:35
  • You'll need to format the message as a MIME email. See stackoverflow.com/q/17359/7552 for some examples. Jul 22 '19 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.