CDONTS Attachments

ashish908
08-01-2002, 01:39 AM
I am using CDONTS to send mails through the website i am developing. i wish to send an attachment with the mail, for that i write the following code,

mymail1.attachFile server.mappath("./data/res2.doc")

it works, but only thing is that the mail shows me the attachment in junk characters. I do not get the above document as attachment but it is already displayed in the mail in the form of junk characters.

Can anyone explain why and what to do to solve it??

Thanks

Rezner
08-01-2002, 12:19 PM
Try doing it by using backward slashes instead of forward slashes. Also, try it without the Server.MapPath. Here's an example of what I mean:<%
set objMail = createobject("CDONTS.NewMail")
objMail.AttachFile "c:\documents\picture.jpg"
objMail.send "from@here.com", "to@there.com", "Subject Line", "Message Body"
set objMail = nothing
%>

ashish908
08-02-2002, 07:11 AM
i have hosted my site with an ISP. I would have to use server.mappath else How would i know the absolute path. and what if they change the location of their IIS in future.

ashish908
08-02-2002, 07:29 AM
i got it. I made a string concatenating the server.mappath value and then using backslash as suggest by rezner.

but the problem is when the mail is sent to web based mail system (like yahoo/rediffmail.com) it displays junk character but when i check in some mail client it works properly. Is it the web based mail problem

Rezner
08-02-2002, 09:10 AM
The Server.MapPath was not the problem. I was just trying to simplify things for the troubleshooting process.

The Server.MapPath returns a string to a local path. In your first post, you were combining a virutal path with the local path from the Server.MapPath method. I am amazed that it actually even sent anything and didn't crash. It is important not to mix these:'local path
strLocal = "C:\inetpub\wwwroot\pics\vacation1\"

'virtual path
strVirtual = "../pics/vacation2/"I have no idea why it is screwing things up with the web based email systems. I just ran the exact same chunk of code on my IIS and it worked fine when I sent it to hotmail.com

ashish908
08-02-2002, 09:44 AM
ya it works fine with hotmail, but with yahoo it gives an error.

i used the following because i was not sure of the local path.

datapath= server.mappath("./") & "\res2.doc"

Also this will take care if the server people decide to move the IIS location in future


thanks for the help!!!!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum