Team,
Presently i have the below script which sends the attachment but in a .bat method, i want it more of readable method.i.e(abc.log) for which i am doing the cat
cat abc.log | mailx -s "Todays logs $(date)" <my_email_id.com>
Regards
Whizkid
Team,
Presently i have the below script which sends the attachment but in a .bat method, i want it more of readable method.i.e(abc.log) for which i am doing the cat
cat abc.log | mailx -s "Todays logs $(date)" <my_email_id.com>
Regards
Whizkid
Hi,
You could try this;
cat abc.log > /tmp/attacment.log
mailx -a /tmp/attachment.log -s "Todays logs $(date)" <my_email_id.com>
This should make things a bit more readable.
Regards
Dave
uuencode abc.log abc.log | mail -s "Todays logs $(date)" my_email_id@domain.com
Hi Whizkidash,
Have I failed to understand this, in response to Srinishoo's answer - are you saying that the log file is a "Binary" file. A ".bat" file would normally be a text file - in a "Windows/DOS" environment this would normally be processed by "COMMAND.COM".
Regards
Dave
Hi Gul,
When i try with your below provided commands it goes into iterations, i.e it does not comes out of the loop.
mailx -a /tmp/attachment.log -s "Todays logs $(date)" <my_email_id.com>
Hi Srini,
I tried doing with the uuencode command earlier but its not working.
it gives me the below msg:
-bash: uuencode: command not found
Regards
Whizkid
You may try mutt,
---------- Post updated at 08:43 AM ---------- Previous update was at 08:42 AM ----------
use this
mailx -s "Todays logs $(date)" < /tmp/attacment.log youremail.com
or if you want to be attachment.. mv the attachment.log to attachment.txt,
Hi Whizkidash,
What does the following command return;
file abc.log
Also you could try the command format as follows;
`mailx -s "Todays logs $(date)" -a /tmp/attachment.log <my_email_id.com>`
Let me know how you get on.
Regards
Dave
Hi gul,
Below is the output when i do
file abc.log
abc.log: ASCII English text, with CRLF, LF line terminators
even i tried with your command as suggested, but as said earlier its going on iteration.(i.e its going in the loop) i have to do a control+C to come out.
Regards
Whizkid
Hi,
It looks like this may be a dos format file, check if you have "dos2unix" if not you can pipe the file through any number of unix utilities to convert to a unix format.
Regards
Dave
Hi Dave,
Could provide me with the specific examples.. it would indeed be great assistance.
What OS are we dealing with?
Its Linux Vbe..
Hi Wizkidash,
The format for the "dos2unix" command is;
dos2unix < abc.log > file_name
You should then be able to mail the file, if there is still an issue - post the output of.
head abc.log | cat -v -t
Regards
Dave
Perl is probably the most robust way to send emails with attachments. You need the mime:lite perl utility, but it is well documented.
Thanks for sharing gandolf989.. will need to check once before i implement