LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Send emails in HTML format through mailx (https://www.linuxquestions.org/questions/linux-newbie-8/send-emails-in-html-format-through-mailx-4175532372/)

charithsrng 01-29-2015 04:51 AM

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.

TB0ne 01-29-2015 10:13 AM

Quote:

Originally Posted by charithsrng (Post 5308158)
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.


All times are GMT -5. The time now is 05:10 AM.