From: Deep on
Dear friends,
Is it possible to write mail attachment program usig cdo.message
component. if yes please tell me how to do it?
I am doing like this and it is giving error
-------------------
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'AttachFile'
/asp/mailAttach.asp, line 28
--------------------

strEmail_attach = request("txtFile")

Set newmail = server.CreateObject ("CDO.Message")

newmail.from = "vinodkus(a)yahoo.com"
newmail.to = "vinodkus(a)gmail.com"
newmail.subject = "Appear For First level Exam"

If strEmail_attach <> "" then
newmail.AttachFile(strEmail_attach)
End If

newmail.HTMLBody = "Hi how r u"
newmail.send
Set newmail = Nothing
From: Bob Barrows on
Deep wrote:
> Dear friends,
> Is it possible to write mail attachment program usig cdo.message
> component. if yes please tell me how to do it?
> I am doing like this and it is giving error
> -------------------
> Error Type:
> Microsoft VBScript runtime (0x800A01B6)
> Object doesn't support this property or method: 'AttachFile'
> /asp/mailAttach.asp, line 28
> --------------------
>
> strEmail_attach = request("txtFile")
>
> Set newmail = server.CreateObject ("CDO.Message")
>
> newmail.from = "vinodkus(a)yahoo.com"
> newmail.to = "vinodkus(a)gmail.com"
> newmail.subject = "Appear For First level Exam"
>
> If strEmail_attach <> "" then
> newmail.AttachFile(strEmail_attach)
> End If
>
> newmail.HTMLBody = "Hi how r u"
> newmail.send
> Set newmail = Nothing

I'm not sure where you found that AttachFile method ... here's the right
way:
http://www.paulsadowski.com/wsh/cdo.htm
There are also examples here:
http://www.aspfaq.com/search.asp?q=cdo+attach


--
HTH,
Bob Barrows


From: Evertjan. on
Deep wrote on 14 jun 2010 in microsoft.public.inetserver.asp.general:

> Dear friends,
> Is it possible to write mail attachment program usig cdo.message
> component. if yes please tell me how to do it?
> I am doing like this and it is giving error
> -------------------
> Error Type:
> Microsoft VBScript runtime (0x800A01B6)
> Object doesn't support this property or method: 'AttachFile'
> /asp/mailAttach.asp, line 28
> --------------------
>
> strEmail_attach = request("txtFile")
[..]
> newmail.AttachFile(strEmail_attach)

Did you read the specs of CDO,
or dit you just pick some code from the web
witout looking what object was created?

..AttachFile is CDONT

..AddAttachment is CDO

<http://www.devguru.com/features/tutorials/cdonts/cdonts.html>

==================================

more:

1 the () are not necessary induces difficult bugs
if later on you ad a second parameter:

newmail.AddAttachment strEmail_attach

2 Warning: the file should be on the server, while the querystring comes
from the client.

3 Better use Server.mappath() if the querystring contains wwwroot
adressing:

newmail.AddAttachment Server.mappath(strEmail_attach)

3 request("txtFile") is to symplistic, induces difficult bugs, use:

request.form("txtFile")
or
request.querystring("txtFile")

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)