473,591 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10436
http://support.microsoft.com/default.aspx/kb/286430

<br************ ********@yahoo. co.ukwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.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.goog legroups.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.goog legroups.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 cdoContentDispo stion = "urn:schemas:ma ilheader:conten t-disposition"
Const cdoBase64 = "base64"

Set oPart = oMsg.Attachment s.Add

oPart.ContentMe diaType = "applicatio n/octet-stream"
oPart.ContentTr ansferEncoding = cdoBase64

oPart.Fields(cd oContentDisposi tion).Value = "attachment ;
filename=""Test .dat"""
oPart.Fields.Up date

Set oStreamOut = oPart.GetDecode dContentStream
oStreamOut.Writ e aByt
oStreamOut.Flus h
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.goog legroups.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 cdoContentDispo stion = "urn:schemas:ma ilheader:conten t-disposition"
Const cdoBase64 = "base64"

Set oPart = oMsg.Attachment s.Add

oPart.ContentMe diaType = "applicatio n/octet-stream"
oPart.ContentTr ansferEncoding = cdoBase64

oPart.Fields(cd oContentDisposi tion).Value = "attachment ;
filename=""Test .dat"""
oPart.Fields.Up date

Set oStreamOut = oPart.GetDecode dContentStream
oStreamOut.Writ e aByt
oStreamOut.Flus h
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.goo glegroups.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 cdoContentDispo sition = "urn:schemas:ma ilheader:conten t-disposition"

Dim oPart : Set oPart = oMsg.Attachment s.Add

oPart.ContentMe diaType = "text/plain; charset=iso-8859-1"
oPart.CharSet = "iso-8859-1"
oPart.ContentTr ansferEncoding = "quoted-printable"

oPart.Fields(cd oContentDisposi tion).Value =
"attachment;fil ename=""Test.tx t"""
oPart.Fields.Up date

Dim oStreamOut: Set oStreamOut = oPart.GetDecode dContentStream
oStreamOut.Writ eText sContent
oStreamOut.Flus h

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.goog legroups.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 cdoContentDispo stion =
"urn:schemas:ma ilheader:conten t-disposition"
Const cdoBase64 = "base64"

Set oPart = oMsg.Attachment s.Add

oPart.ContentMe diaType = "applicatio n/octet-stream"
oPart.ContentTr ansferEncoding = cdoBase64

oPart.Fields(cd oContentDisposi tion).Value = "attachment ;
filename=""Test .dat"""
oPart.Fields.Up date

Set oStreamOut = oPart.GetDecode dContentStream
oStreamOut.Writ e aByt
oStreamOut.Flus h
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.goo glegroups.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 cdoContentDispo sition = "urn:schemas:ma ilheader:conten t-disposition"

Dim oPart : Set oPart = oMsg.Attachment s.Add

oPart.ContentMe diaType = "text/plain; charset=iso-8859-1"
oPart.CharSet = "iso-8859-1"
oPart.ContentTr ansferEncoding = "quoted-printable"

oPart.Fields(cd oContentDisposi tion).Value =
"attachment;fil ename=""Test.tx t"""
oPart.Fields.Up date

Dim oStreamOut: Set oStreamOut = oPart.GetDecode dContentStream
oStreamOut.Writ eText sContent
oStreamOut.Flus h

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.goog legroups.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 cdoContentDispo stion =
"urn:schemas:ma ilheader:conten t-disposition"
Const cdoBase64 = "base64"
>
Set oPart = oMsg.Attachment s.Add
>
oPart.ContentMe diaType = "applicatio n/octet-stream"
oPart.ContentTr ansferEncoding = cdoBase64
>
oPart.Fields(cd oContentDisposi tion).Value = "attachment ;
filename=""Test .dat"""
oPart.Fields.Up date
>
Set oStreamOut = oPart.GetDecode dContentStream
oStreamOut.Writ e aByt
oStreamOut.Flus h
>
>
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
2654
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" listing in my address book and (optionally) their name listed on my "news" page of my birtle.com website (listed as "Jane Smith is a Programming GOD") for at least a month. Why not take a moment to read more and possibly boost your ego to all time...
0
2343
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). The button work fine when I run it at my local machine. However, when I moved all the programs over to the server, I am unable to view the attachment, although I have the file physically at the server. The error message that I got is: ...
1
2302
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 CreateDimeWord(ByVal DotName As String, ByVal sXML As String) As String Dim respContext As SoapContext = ResponseSoapContext.Current
0
1440
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 CreateDimeWord(ByVal DotName As String, ByVal sXML As String) As String Dim respContext As SoapContext = ResponseSoapContext.Current
7
6802
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 Inbox As Outlook.MAPIFolder Dim InboxItems As Outlook.Items Dim Mailobject As Object Set OlApp = CreateObject("Outlook.Application")
0
2473
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" value="pras_sandilya@rediffmail.com"></td> </tr>
1
2398
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 his Apple Mail but attempts to open it fail. If he forwards the email to Gmail he can open the attachment from there so it is a mail client issue, not a file issue. This sounds to me like maybe the boundaries I am setting have issues?
2
6885
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 through. I do not get any errors in my python code. I pasted my python code below. from email.MIMEBase import MIMEBase from email.MIMEMultipart import MIMEMultipart from email import Encoders
2
4279
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 any thouhgts on how to get it in as an attachment. CODE: <?php ini_set(SMTP, "172.18.1.65");
0
7934
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7870
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8362
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7992
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5732
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3850
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1465
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.