Link to home
Start Free TrialLog in
Avatar of jlcannon
jlcannon

asked on

CDO.Message not able to send attachement

I have an asp page that the SendMail works perfectly fine until I try to add the :

ObjSendMail.AddAttachment = "../Files/brainteaser1.ppt"

I get an error that says:

Object doesn't support this property or method: 'AddAttachment'

/FunFacts/FFSubscribe.asp, line 189

I get the same error when I use a network path or even a local path on my C: drive. not sure what I am doing wrong. the full code looks like the following.


<%
Dim ObjSendMail
Dim iConf
Dim Flds
Dim Body
Dim vAt


vAt="@eximc.nam.happy.com"

Body = Body & "Thank you for subscribing to Fun Facts. You will soon begin receiving the current fun facts via email." & VbCrLf
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

     
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
     
'**** Path below may need to be changed if it is not correct
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
     
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = Uname & vAt
ObjSendMail.Subject = "Thank you for subscribing to Fun Facts"
ObjSendMail.From = "FunFacts@happy.com"
ObjSendMail.AddAttachment = "../Files/brainteaser1.ppt"
     
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = Body
ObjSendMail.TextBody = Body
     
ObjSendMail.Send
     
Set ObjSendMail = Nothing
%>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jlcannon
jlcannon

ASKER

When I change to code to the above I get :

CDO.Message.1 error '800c000d'

The specified protocol is unknown.

/SafetyFacts/SFSubscribe.asp, line 189
try hard coding the path to the file to make sure that it's correct
actually, you DO need a fully qualified path, so give this a shot:

ObjSendMail.AddAttachment Server.MapPath( "../Files/brainteaser1.ppt" )
Thank you greatly. It was the = that kept it from working to begin with and then once I hard coded the path is worked perfectly. thank you. the devil is always in the details.