mail attachment program using mailmessage

D

Deep

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 = "(e-mail address removed)"
newmail.to = "(e-mail address removed)"
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
 
B

Bob Barrows

Deep said:
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 = "(e-mail address removed)"
newmail.to = "(e-mail address removed)"
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
 
E

Evertjan.

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

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

code for mail attachment 1
CDONTS.Newmail error 0
Mail Sending program 1
ASP.NET Send Mail - Access is denied. 3
email Problem 0
mail program in asp 0
Deleting curent record 8
Cannot send mail from ASP using CDO 2

Members online

No members online now.

Forum statistics

Threads
473,794
Messages
2,569,641
Members
45,355
Latest member
SJLChristi

Latest Threads

Top