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:
Code:
# 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:
HP-UX mbhp7640 B.11.31 U ia64 4294967295 unlimited-user license
Our database builds a MIME compliant html email, then cats that to sendmail - no problem.
Due to horrible issues with the native uuencode, we long ago began using uuenview to encode our attachments - no problem. An example is... (1 Reply)
Hello All,
I have a query here. I am sending an HTML table(which I am creating it by a call to REST API, in a LINUX box) and from there I have to send it into an email. So following are the poins on same:
As data is not static so it is writing Dynamic data and creating HTML file.
There is... (9 Replies)
I am using Sun Solaris ver. 5.10 and trying to send an HTML table in email body using mail command in C shell script.
I tried following commands:-
#1
mail -m "MIME-Version: 1.0;Content-type:text/html;charset=UTF-8" receiver@mail.com < file.html #2
mail -m "Content-type: text/html;" -s "This... (4 Replies)
Hi ,
I have a sql query in the unix script ,whose output is shown below.I want to convert this output to HTML table format & send email from unix with this table as email body.
p_id src_system amount
1 A 100
2 B 200
3 C ... (3 Replies)
Hi All,
I am trying to send the contents of a file as email body. I am using html email and sendmail option of unix. I am using the below piece of code for the same :
#!/usr/bin/ksh
export MAILTO="email@domain.com"
export SUBJECT="Report"
export BODY="file_directory_path/test_file.txt"... (1 Reply)
Hi,
Im having a bit of an issue with using the uuencode command and sending out an email.
My aim is to send an email out which has a body and also have attachments. Currently I can either get one or the other and not both on the same email.
uuencode... (4 Replies)
Hi all:
Been racking my brain on this for the last couple of days and what has been most frustrating is that this is the last piece I need to complete a project.
There are numerous posts discussing mutt in this forum and others but I have been unable to find similar issues.
Running with... (1 Reply)
Hello ,
I am trying to send an email with two attachments . I have tried all previous suggestion in this forum but none worked. I could send one attachment in an email by
uuencode $file "$file" | mailx -m -s "File" xxx@xx.com
but unable to send multiple attachments .
I have tried
... (8 Replies)
Hi there..
I need a proper "mutt" command to send a mail with html body and html attachment at a time.
Also if possible let me know the other commands to do this task.
Please help me.. (2 Replies)