LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-29-2015, 05:51 AM   #1
charithsrng
LQ Newbie
 
Registered: Jan 2013
Posts: 26

Rep: Reputation: Disabled
Send emails in HTML format through mailx


I have created a sql file and it will create a HTML file with query result.But I'm unable to retrieve a html body in my email instead am getting a mail body with html tags.Please help

sql----

--sample HTML report.
--
-- Usage: sqlplus LOGON @script OUTPUT_FILENAME
--

-- Activate HTML output and configure the generated markup.
SET MARKUP HTML ON SPOOL ON -
HEAD '<title>My Report</title> -
<style type="text/css"> -
table { background: #eee; font-size: 80%; } -
th { background: #ccc; } -
td { padding: 0px; } -
</style>'

-- Dump results to the file that is given on the command line.
SPOOL &1

-- Only dump to file, not to the terminal.
SET TERMOUT OFF

-- Titles and formatting of columns.
COLUMN name HEADING 'Name'
--COLUMN job HEADING 'Job Title'
--COLUMN salary HEADING 'Salary' FORMAT $99,990

-- The query
--
select tablespace_name from dba_tablespaces;
/

-- Close file, which also closes the HTML tags.
SPOOL OFF

-- Back to non-HTML output
SET MARKUP HTML OFF


mailx command----

mailx -s 'file system' c.bambarandage@prima.com.lk < sam.html

Thanks,
Charith.
 
Old 01-29-2015, 11:13 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,324

Rep: Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471Reputation: 4471
Quote:
Originally Posted by charithsrng View Post
I have created a sql file and it will create a HTML file with query result.But I'm unable to retrieve a html body in my email instead am getting a mail body with html tags.Please help
There's nothing we can really help WITH...for a couple of reasons.

First, you say you're getting the email, and it's formatted exactly how you want it...just not DISPLAYING correctly. That means, there is NOTHING wrong with the Linux side of things, and you're getting the email correctly. Your mail client, however, isn't displaying it as such. Short answer: go into your mail client settings and tell it to display HTML.

Second...you don't provide us ANY details about version/distro of Linux on the server, what is running on the client, what mail client you're using, or how it's configured. Without details, there is little we can do.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix not sending all emails generated from mailx command nancydrew72 Linux - Newbie 3 10-21-2014 01:37 PM
How to send mails using HTML format with mailx client ? shivaa Linux - Newbie 1 02-23-2013 03:04 AM
[SOLVED] How to send a mail in HTML format using mailx or mail or sendmail commands vishnu_knl Linux - Newbie 8 04-05-2012 11:00 AM
SVN : - some mails are coming in plain format (html coding) & some in html format deepakdeore2004 Linux - General 0 05-06-2010 02:54 AM
convert html emails to plain text emails andredude Linux - General 6 03-20-2005 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration