1 |
It seems to me that you need a couple of other things: |
2 |
|
3 |
1. a look at a couple of the html emails in my inbox show a mail |
4 |
header (ie part of the email where stuff like from, to and subject go) like this: |
5 |
|
6 |
MIME-Version: 1.0 |
7 |
Content-Type: multipart/alternative; |
8 |
boundary="----_=_NextPart_001_01C5B8D9.821B04F0" |
9 |
|
10 |
you can add extra headers using the mail command with the -a parameter |
11 |
(according to man mail) |
12 |
|
13 |
" -a Specify additional header fields on the command line such as "X-Loop: foo@bar" etc. You have to use |
14 |
quotes if the string contains spaces. This argument may be specified more than once, the headers |
15 |
will then be concatenated." |
16 |
|
17 |
2. The body of the message must be in mime format using the same "boundary" as is specified in the header like this: |
18 |
|
19 |
------_=_NextPart_001_01C5B8D9.821B04F0 |
20 |
Content-Type: text/plain |
21 |
(here is the text part of the message) |
22 |
|
23 |
------_=_NextPart_001_01C5B8D9.821B04F0 |
24 |
Content-Type: text/html |
25 |
Content-Transfer-Encoding: quoted-printable |
26 |
|
27 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> |
28 |
<HTML> (all the html bits) |
29 |
</HTML> |
30 |
|
31 |
below that the boundary is specified again: |
32 |
|
33 |
------_=_NextPart_001_01C5B8D9.821B04F0-- |
34 |
|
35 |
(thats the very last line in the file) |
36 |
|
37 |
|
38 |
3. i tried using mpack to make an html message from the command line, |
39 |
but it didn't work - I might be doing something wrong. |
40 |
|
41 |
|
42 |
On Fri, 16 Sep 2005 07:07:23 +0800 |
43 |
Ow Mun Heng wrote: |
44 |
|
45 |
> Hi, |
46 |
> |
47 |
> I'm writing a bash script that basically checks for stocks prices and I |
48 |
> want the formatted output to be mailed to me. I've got the script |
49 |
> working already. The only problem is the HTML is well, not displayed as |
50 |
> HTML, it's displayed RAW(and not formatted). |
51 |
> |
52 |
> I'm using cron to send the email out. |
53 |
> |
54 |
> I've even put the echo statement : |
55 |
> |
56 |
> html_header() |
57 |
> { |
58 |
> echo "Content-Type: text/html; charset=iso-8859-1" |
59 |
> echo "<HTML><HEAD><TITLE>Stock Quotes :" $DATE "</TITLE></HEAD>" |
60 |
> echo '<STYLE TYPE="TEXT/CSS">' |
61 |
> echo "h1 {color: gray; border-bottom: 3px double silver}" |
62 |
> echo "h2,h3 {color: gray; border-bottom: 1px solid silver}" |
63 |
> echo "</STYLE></HEAD>" |
64 |
> echo "<BODY>" |
65 |
> echo "<H1>Stock Quotes :" $DATE "</H1>" |
66 |
> echo "<BR><BR>" |
67 |
> } |
68 |
> |
69 |
> |
70 |
> but all I get is : |
71 |
> |
72 |
> Content-Type: text/html; charset=iso-8859-1 |
73 |
> <HTML><HEAD><TITLE>Stock Quotes : Fri Sep 16 06:52:02 2005 |
74 |
> </TITLE></HEAD> |
75 |
> <STYLE TYPE="TEXT/CSS"> |
76 |
> h1 {color: gray; border-bottom: 3px double silver} |
77 |
> h2,h3 {color: gray; border-bottom: 1px solid silver} |
78 |
> </STYLE></HEAD> |
79 |
> <BODY> |
80 |
> <H1>Stock Quotes : Fri Sep 16 06:52:02 2005 </H1> |
81 |
> <BR><BR> |
82 |
> |
83 |
> What sort of "content-type" do I need to put into it? or do I have to |
84 |
> format the message and use sendmail -t < quote |
85 |
> |
86 |
> |
87 |
> -- |
88 |
> Ow Mun Heng |
89 |
> Gentoo/Linux on DELL D600 1.4Ghz 1.5GB RAM |
90 |
> 98% Microsoft(tm) Free!! |
91 |
> Neuromancer 07:03:30 up 2 days, 19:38, 6 users, load average: 0.80, |
92 |
> 0.49, 0.52 |
93 |
> |
94 |
> |
95 |
> -- |
96 |
> gentoo-user@g.o mailing list |
97 |
|
98 |
-- |
99 |
Nick Rout <nick@×××××××.nz> |
100 |
|
101 |
-- |
102 |
gentoo-user@g.o mailing list |