# cat sample.html
<html>
<body>
Sample HTML file</p>
</body>
</html>
And I have two excel sheets (sheet1.xls & sheet2.xls)
I want to send an email by having the sample.html as the message body and two spreadsheets as the attachments.
I tried using the below command:
We are getting the message body, but the attachments are missing in the email. If I remove the "Content-type: text/html", then I am getting both attachment and the message body, but the message body is coming with html tags and they are actually not getting parsed.
This was answered just a little while ago...search the forums.
Short answer: you can't get attachments and HTML with sendmail.
I believe the solution was to use the mutt email client.
I'm new to UNIX and need some assistance in creating/sending an email containing HTML body and a .csv attachment. I've found
numerous posts on the forum that discuss this, however none of the solutions work. I've created a KSH script running on UNIX AIX.
I found a post with a solution that works on a linux box which has uuencode --base64, but it did not work for me. The code ran
but did not send the email.
Any suggestions......
My .html file looks something like this:
# cat email.html
<html>
<body>
Sample HTML file</p>
</body>
</html>
I'm able to send the html formatted email with no attachments using the following code:
Thanks, that works and the email is sent with the attachment and the formatted HTML. The only issue is I'm getting 2 errors as follows:
-m: No such file or directory
-m: No such file or directory
When I man uuencode I don't see the -m option. When I remove this from the code, the email is sent with 2 attachments (both the same). When I remove the last block of code in your example, the email is sent with 2 attachments, the second file is an empty notepad .txt file. Can you explain this?
Syntax
uuencode [ -m ] [ SourceFile ] OutputFile
Description
The uuencode command converts a binary file to ASCII data. This is useful before using BNU (or uucp) mail to send the file to a remote
system. The uudecode command converts ASCII data created by the uuencode command back into its original binary form.
The uuencode command takes the named SourceFile (default standard input) and produces an encoded version on the standard output. The encoding
uses only printable ASCII characters, and includes the mode of the file and the OutputFile filename used for recreation of the binary image
on the remote system.
Use the uudecode command to decode the file.
Flags
-m
Encode the output using the MIME Base64 algorithm. If -m is not specified, the old uuencode algorithm will be used.
I used your code exactly the way you wrote it only changing the values in the export statment for the various variables (ie email address, html body, attachment & subject). On the fist run I received the email with the html body and the attachment but received the errors regarding the -m flag.
On a subsequent run, I removed the -m flag from both blocks and received the email with the html body but to copies of my $ATTACH file were attached. The code is as follows:
On the last run, I removed the 2nd block which references the $ATTACH file and this time I received the email with the html body, my $ATTACH file and a 2nd attached file that was an empty .txt file. The code is as follows: