By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

Data stream as attached in Classic ASP using CDO

P: 1
Does anyone know how to attached a data stream to CDO Message email sending object in Classic ASP using Javascript?

Pls. let me know if u know!

I have following code which is not working.

var myMail = Server.CreateObject("CDO.Message");
var cdoContentDispostion = "urn:schemas:mailheader:content-disposition";
var cdoBase64 = "base64";
var sContent="test datas";

myMail.Subject="Downloads";
myMail.From="balaji.sivan@parker.com";
myMail.To="balaji.sivan@parker.com";
myMail.TextBody="This is a message.";
//myMail.AddAttachment
var oPart = myMail.Attachments.Add();
oPart.ContentMediaType = "application/octet-stream";
oPart.ContentTransferEncoding = cdoBase64;
oPart.Fields(cdoContentDisposition).Value = "attachment;filename=""Test.txt""";
oPart.Fields.Update();

var oStreamOut = oPart.GetDecodedContentStream();
//oStreamOut.Write(BinaryData);
oStreamOut.WriteText(sContent);
oStreamOut.Flush();

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2;
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp1.us.parker.corp";
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25;
myMail.Configuration.Fields.Update();
myMail.Send();
Nov 15 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.