Hi,
I'm using webspeed 3.1d on unix.
I've created a report in excel (via appserver on windows) and transfered it back to my calling webspeed program in a temp-table with a raw data format.
The program works fine when I tell it to open up the excel document in the broswer.
But I would like to also send this excel document as an email attachment using sendmail.
So far I've done this:
I actually receive an excel document as an attachment and when I open it I just get a list of weird unreadable characters.
Any suggestions as to what's happening?
Thanks in Advance
Obi
I'm using webspeed 3.1d on unix.
I've created a report in excel (via appserver on windows) and transfered it back to my calling webspeed program in a temp-table with a raw data format.
Code:
DEFINE TEMP-TABLE ttFile
FIELD SeqNo AS INT
FIELD FileData AS RAW
INDEX ttFileIdx IS PRIMARY SeqNo ASCENDING.
The program works fine when I tell it to open up the excel document in the broswer.
Code:
/* output to WebBrowser */
{&OUT} "Content-Type: application/vnd.ms-excel" SKIP
"Accept-Ranges: none" SKIP
"Content-Length: " vFileLength FORMAT ">>>>>>9" SKIP (1).
FOR EACH ttFile BY SeqNo:
PUT {&WEBSTREAM} CONTROL ttFile.FileData.
END.
But I would like to also send this excel document as an email attachment using sendmail.
So far I've done this:
Code:
v-from1 = "blah@blah.com".
v-recipient = "blah@blah.com".
v-addressline = v-from1 + " " + v-recipient.
v-recipients = "/usr/lib/sendmail/ " + v-addressline.
OUTPUT STREAM ptstream THROUGH VALUE(v-recipients).
PUT STREAM ptstream UNFORMATTED
"From: " v-from1 SKIP
"Reply-To: " v-from1 SKIP
"To: " v-recipient SKIP
"Subject: report test" SKIP
"MIME-Version: 1.0" SKIP
"X-Mailer: Internet Mail Service (5.5.1960.3)" SKIP
"Content-Type: multipart/mixed;" SKIP
" boundary = aboundary" SKIP(2)
"This is a multi-part message in MIME format." SKIP(2)
"--aboundary" SKIP
"Content-Type: text/html;" SKIP(2)
"test email. " SKIP(2)
"--aboundary" SKIP
.
PUT STREAM ptstream UNFORMATTED
"Content-Type: application/vnd.ms-excel;" SKIP
" name = report.xls;" SKIP
"Content-transfer-encoding: quoted-printable;" SKIP
"Content-Disposition: attachment;" SKIP
"Accept-Ranges: none;" SKIP
"Content-Length: " vFileLength FORMAT ">>>>>>9" ";" SKIP
"filename = report.xls;" SKIP(2)
.
FOR EACH ttFile BY SeqNo:
PUT STREAM ptstream CONTROL ttFile.FileData.
END.
PUT STREAM ptstream UNFORMATTED
"--aboundary--" SKIP
.
OUTPUT STREAM ptstream CLOSE.
output-content-type ("text/html":U).
{&out}
'email has been sent ..... hopefully'.
I actually receive an excel document as an attachment and when I open it I just get a list of weird unreadable characters.
Any suggestions as to what's happening?
Thanks in Advance
Obi