Email with attachment from local machine through UNIX
Hello everyone,
So, here is my requirement.
I want to run an SQL query and export the result in an excel file and send that as an attachement in an email to the intended receipients.
Please help me understand how to do that.
How to connect to database, how to export the output in an excel file and how to attach it to an email and send it.
Also let me know if a file from local machine can be attached and sent through email by a unix/linux command.
P.S: I am a beginner in UNIX/Linux.
Thanks in advance
Last edited by Mohdrafi12; 01-13-2015 at 09:53 AM..
find yourself a copy of metamail. Some distros of Linux don't supply metamail anymore, but at the same time, they don't seem to be supplying an alternative either.
This depends on the SQL client you're using; however, mostly every SQL UNIX client can do something like this, here is an example using mySql.
I have a file that contains my sql statements: my.sql.query.file and I save the results in file saved.query.txt (this is not the only way to run sql commands from the command )...
Note: the use of the -b switch will use tab as the delimiter between fields in the saved.query.txt file. You will have to consult your sql client to see if you can specify an output field delimeter. I think the default for mysql is comma with field enclosed in "
Sending attachments in email can be done in this fashion (this is
the traditional way of sending attachments...
Since I used the -b option on my output file, I simply import it into excel asking it to use tab as the delimeter.
What you are asking is to basically design and code an application.
I'm providing you what you asked directly, we are not a coding service.
You are asking:
how to email a file as an attachment
Oracle with a tab delimited csv file:
email:
Next time please make an effort and show what you did. Give information about your UNIX system and the database: sql server, oracle, db2. This directly answered your questions, but it is next to useless for you, in the same way your question is not useful for us.
Hi - How would you read in the attachment from your unix mail account? The attachment is in BASE64 so I need to isolate those lines so I can convert them. The number of lines varies from a few to a few hundred. To complicate matters, the mail box gets non related emails I want to ignore. The lines... (3 Replies)
Team,
I have the below code, which is working fine and it sends the html report using sendmail command.
I want to attach one more file ( which goes as attachment ) in that email. How to achieve it.
i tried with uuencode. But no luck :mad:
outputFile="/tmp/out.html"
(
echo... (2 Replies)
Hi All..
Am new to Unix!!
Am creating a shell script in which a scenario is like i have transfer the output file from unix machine (Server) to local directory (Windows xp).
And also i have to transfer the input file from the local directory to Unix machine (Server)
Any help from you... (1 Reply)
Hi,
I have a syntax for mail attachment as
$EMAIL "Wrapper $wrapper_script_name has failed" " $wrapper_script_name has Failed " $failed_email_address
and $EMAIL is as below
MSGSub=${1}
MSGText=${2}
RMAIL=${3}
#set LANG=''
export LANG=''
echo "${MSGSub}" | mailx -s "${MSGText}" ... (1 Reply)
Hi,
I have a shell script which send email with an attachment in the form of an email. However, the when I open the attachment, all the data comes in one column. How do I format the data in the excel sheet while sending the email?
Thanks (8 Replies)
Hello All,
This is a common question that I found lot of results in the forums.
I am trying to use uuencode to attach a file and send email. I have no issues sending email, but not able to attach any files using sendmail.
Is uuencode part of sendmail or does 'uuencode' utility need to be... (1 Reply)
Hi all,
I have searched the FAQ and find that there is some threads related to this subject.
But can you please give an examples on how to send attachment to Lotus Notes email through UNIX?
Since i have gone through the RFC and the URL. But i still have no idea on it.
Please give some... (7 Replies)
We have been trying to get an email from unix to Lotus Notes to work. We finally got it to work with the following code:
cat filename | uuencode filename | mailx -s "subject title" email address
Now our problem is that Lotus Notes doesn't show the paper clip icon, indicating an attachment... (3 Replies)
I've written a a script which generates a report file, saved to a unix directory. I need to transfer it, via email, to some users. The command I'm using in my script is:
(note that subject & cur_address are set in the script prior to this line)
cat /u/sandyl/sm_o_commdt_archive/c | uuencode... (3 Replies)
I've written a a script which generates a report file, saved to a unix directory. I need to transfer it, via email, to some users. The command I'm using in my script is:
(note that subject & cur_address are set in the script prior to this line)
cat /u/sandyl/sm_o_commdt_archive/c | uuencode... (3 Replies)