473,385 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Create an email attachment using a stream in classic ASP (not ASP.Net)

Hi,

Does anyone know how to create an attachment using a stream in classic
ASP.

I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.

Any help is greatly appreciated.

regards
Brendan

Nov 8 '06 #1
6 10422
http://support.microsoft.com/default.aspx/kb/286430

<br********************@yahoo.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,

Does anyone know how to create an attachment using a stream in classic
ASP.

I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.

Any help is greatly appreciated.

regards
Brendan

Nov 8 '06 #2
Thanks. I should have also mentioned in my original query that I want
to avoid creating a file on any directory. I just want to set the
content of the attachement to the content of a stream.

Slim wrote:
http://support.microsoft.com/default.aspx/kb/286430

<br********************@yahoo.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,

Does anyone know how to create an attachment using a stream in classic
ASP.

I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.

Any help is greatly appreciated.

regards
Brendan
Nov 8 '06 #3

<br********************@yahoo.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,

Does anyone know how to create an attachment using a stream in classic
ASP.

I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.

Any help is greatly appreciated.

regards
Brendan
Heres an example:-

Const cdoContentDispostion = "urn:schemas:mailheader:content-disposition"
Const cdoBase64 = "base64"

Set oPart = oMsg.Attachments.Add

oPart.ContentMediaType = "application/octet-stream"
oPart.ContentTransferEncoding = cdoBase64

oPart.Fields(cdoContentDisposition).Value = "attachment;
filename=""Test.dat"""
oPart.Fields.Update

Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.Write aByt
oStreamOut.Flush
Where oMsg is an existing cdoMessage (ensure you've added any text and/or
html bodies first) and abyt is the set of bytes that represents the resource
to attach.

What type of content are you attaching?


Nov 8 '06 #4
Hi Anthony,

Thanks for the example. I'll test shortly. I am attaching plain text.

Brendan

Anthony Jones wrote:
<br********************@yahoo.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,

Does anyone know how to create an attachment using a stream in classic
ASP.

I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.

Any help is greatly appreciated.

regards
Brendan

Heres an example:-

Const cdoContentDispostion = "urn:schemas:mailheader:content-disposition"
Const cdoBase64 = "base64"

Set oPart = oMsg.Attachments.Add

oPart.ContentMediaType = "application/octet-stream"
oPart.ContentTransferEncoding = cdoBase64

oPart.Fields(cdoContentDisposition).Value = "attachment;
filename=""Test.dat"""
oPart.Fields.Update

Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.Write aByt
oStreamOut.Flush
Where oMsg is an existing cdoMessage (ensure you've added any text and/or
html bodies first) and abyt is the set of bytes that represents the resource
to attach.

What type of content are you attaching?
Nov 8 '06 #5

<br********************@yahoo.co.ukwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
Hi Anthony,

Thanks for the example. I'll test shortly. I am attaching plain text.
In that case I'll adjust the example:-

Const cdoContentDisposition = "urn:schemas:mailheader:content-disposition"

Dim oPart : Set oPart = oMsg.Attachments.Add

oPart.ContentMediaType = "text/plain; charset=iso-8859-1"
oPart.CharSet = "iso-8859-1"
oPart.ContentTransferEncoding = "quoted-printable"

oPart.Fields(cdoContentDisposition).Value =
"attachment;filename=""Test.txt"""
oPart.Fields.Update

Dim oStreamOut: Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.WriteText sContent
oStreamOut.Flush

Where sContent is the string content you want to include in the email

Brendan

Anthony Jones wrote:
<br********************@yahoo.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,
>
Does anyone know how to create an attachment using a stream in classic
ASP.
>
I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.
>
Any help is greatly appreciated.
>
regards
Brendan
>
Heres an example:-

Const cdoContentDispostion =
"urn:schemas:mailheader:content-disposition"
Const cdoBase64 = "base64"

Set oPart = oMsg.Attachments.Add

oPart.ContentMediaType = "application/octet-stream"
oPart.ContentTransferEncoding = cdoBase64

oPart.Fields(cdoContentDisposition).Value = "attachment;
filename=""Test.dat"""
oPart.Fields.Update

Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.Write aByt
oStreamOut.Flush
Where oMsg is an existing cdoMessage (ensure you've added any text
and/or
html bodies first) and abyt is the set of bytes that represents the
resource
to attach.

What type of content are you attaching?

Nov 8 '06 #6
Thanks Anthony. Your code works perfectly.
Brendan
Anthony Jones wrote:
<br********************@yahoo.co.ukwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
Hi Anthony,

Thanks for the example. I'll test shortly. I am attaching plain text.

In that case I'll adjust the example:-

Const cdoContentDisposition = "urn:schemas:mailheader:content-disposition"

Dim oPart : Set oPart = oMsg.Attachments.Add

oPart.ContentMediaType = "text/plain; charset=iso-8859-1"
oPart.CharSet = "iso-8859-1"
oPart.ContentTransferEncoding = "quoted-printable"

oPart.Fields(cdoContentDisposition).Value =
"attachment;filename=""Test.txt"""
oPart.Fields.Update

Dim oStreamOut: Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.WriteText sContent
oStreamOut.Flush

Where sContent is the string content you want to include in the email

Brendan

Anthony Jones wrote:
<br********************@yahoo.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,

Does anyone know how to create an attachment using a stream in classic
ASP.

I can see that it can be done in ASP.Net as per the article below:
Initializes a new instance of the Attachment class with the specified
stream and name.
http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.

Any help is greatly appreciated.

regards
Brendan

>
Heres an example:-
>
Const cdoContentDispostion =
"urn:schemas:mailheader:content-disposition"
Const cdoBase64 = "base64"
>
Set oPart = oMsg.Attachments.Add
>
oPart.ContentMediaType = "application/octet-stream"
oPart.ContentTransferEncoding = cdoBase64
>
oPart.Fields(cdoContentDisposition).Value = "attachment;
filename=""Test.dat"""
oPart.Fields.Update
>
Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.Write aByt
oStreamOut.Flush
>
>
Where oMsg is an existing cdoMessage (ensure you've added any text
and/or
html bodies first) and abyt is the set of bytes that represents the
resource
to attach.
>
What type of content are you attaching?
Nov 13 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Brian Birtle | last post by:
**** A CHALLENGE TO THE GURUS - refute the statement "It's impossible to build a file upload progress meter using ASP.NET" **** First person to prove me wrong gets "All Time .NET Programming GOD"...
0
by: Seok Bee | last post by:
Dear Experts, In my web application, I'm having a button to view an attachment. After I retrieve the record from database (Ms. Access), I have a button to view the attachment (if there is any)....
1
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
0
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
7
by: Dean Spencer | last post by:
Can anyone help? I am importing Emails from Outlook using the following code: Public Function ScanInbox(SubjectLine As String) Dim TempRst As Recordset Dim OlApp As Outlook.Application Dim...
0
by: prasenjit2007 | last post by:
I have a main form for inputing the (to/from/mesg/file) with the following code:- <html> <body> <table> <tr> <td>To:</td> <td><input type="text" name="to" size="50" ...
1
by: jerrygarciuh | last post by:
Hi folks, I have a PHP cron job that compiles a CSV from queries and emails it to some clients. I have a complaint that one client can see the indicating icon to say there is an attachment in...
2
by: Eric E | last post by:
Hello All - I am using python to send an email with a large zip file as an attachment. I successfully sent a 52M attachment. If I try to send a 63M attachment or larger, the message never gets...
2
by: Erik Witkop | last post by:
So I have been trying to get this to work all day. I can't get a local file on my web server to attach to an email. Right now I have it printing out in the body of the email. Please help me with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.