It must be
.AttachFile Server.MapPath("/NewsLette
this one is commented out
AddAttachment "http://www.asp101.com/sam
No it did not work
Main Topics
Browse All TopicsI have a CDONTS email with attachment that is being uploaded first to the server location and then sent as an attachment. For some reason the attachment is being uploaded but the file is not being attached and send as an email. Could anyone find any problems with this code?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
It must be
.AttachFile Server.MapPath("/NewsLette
this one is commented out
AddAttachment "http://www.asp101.com/sam
No it did not work
Use the code below.
NOTE:
1. The CDONTs is now deprecated.
2. "...if you create a Html formatted email, an alternative text/plain part will automatically be created."
http://www.systemwebmail.c
Set objMessage=CreateObject("C
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydoma
myMail.To="someone@somedom
myMail.HTMLBody=body
myMail.AddAttachment Server.MapPath("/NewsLette
myMail.Send
set myMail=nothing
If you have a line in the ASP script that is "On Error Resume Next" then comment it out or remove it. Hopefully between this and Hielo's last suggestion it will provide a useful error.
What operating system is your web server? What version of IIS? If it is older then you may have to stick with CDONTS; it has been deprecated but that doesn't mean old servers can use CDO yet. ;) Hopefully you are on a newer server though.
bol
CDONTS is not supported on the newer server. You need to use CDO instead. Hielo provide an example of using it in http:#20575579 . You can probably just change a few lines in your code to make the change. Let us know if you have a question or need more info to adapt it.
bol
CDONTS is not supported on 2003, right?
Correct. Windows 2003 comes equipped with CDOSYS, whose Object constructor is:
CreateObject("CDO.Message"
The example I provided above (http:#20575579) should work if the server is configured properly and you supply the appropriate field information.
That is the correct syntax. What if you leave off the attachment? Does the email go through?
If so then the problem is the path. Response.Write that part so you can see what the script is producing and compare it to what you need. Let us know if you have a question.
If it doesn't work without the attachment then there is some other problem. What error do you get? Make sure you comment out or remove any lines with "On Error Resume Next." Also if using IE then make sure you aren't using friendly http error messages (Tools -> Internet Options -> Advanced tab). Let me know if you have a question about either of these.
Let us know how this works or if you have a question.
bol
>>Could someone tell me if this is proper CDO syntax?
Yes, the syntax is correct. But the problem you may be dealing with is that you may not be specifying the correct path to the file you want to attach. How do you determine the correct path?
1. Type the full path to your file as if you were going to download it via the browser. Ex:
http://www.yoursite.com/Te
2. Remove the domain part but leave the starting slash. Ex:
/Test/Newsleter/file1.txt
3 From the result on step 2, the corrected code to use would be:
myMail.AddAttachment Server.MapPath("/Test/News
where Filename should contain "file1.txt"
Follow the procedure outlined for YOUR file's path and update your code accordingly.
I figured it out! All of the suggestion from Hielo and b0lsc0tt were correct! and I really appriciate it. The problem was with the IIS server mime settings that prevented most of the formats. So updated code worked but because of the IIS settings files were not sent. Thank you for all the help (I will split the point between you two)
Business Accounts
Answer for Membership
by: jrramPosted on 2008-01-03 at 09:15:03ID: 20574506
Couple of questions:
rs/" & FileName & "")
ples/image s/asp101-1 00x30.gif"
file.doc"
(1) Do you know which of these two lines is causing the issue:
.AttachFile Server.MapPath("/NewsLette
AddAttachment "http://www.asp101.com/sam
(2) I didn't see where 'Filename' was set in your code before it was called. I assumed it its there but you just didn't include it w/ your sample.
(3) If you specified the filename w/o the server.map path does it work?
.AttachFile "C:\directory\Newsletters\