CDONTS sending an email with attachments - Classic ASP

698 Views Asked by At

I want to send an email with attachments using CDONTS. But, here is what i am using:

CDO_MAIL.AttachFile "http://SampleWebSite.com/Sample.asp?COMMAND=6"

In JavaScript we are doing:

image1.src = "http://SampleWebSite.com/Sample.asp?COMMAND=6"

The problem is - I do not have the exact image name. The above URL returns me an image. Can you please let me know how to resolve this ?

Thanks

2

There are 2 best solutions below

2
On BEST ANSWER

Diodeus is correct. However, another way to "solve" this is to download the file so you have it locally and then attach it. Embedding in the HTML, as suggested by Diodeus, will cause most mail clients to block the image and require user interaction to download the image. It's better to do it attach it and reference it by CID.

0
On

CDO does not support HTTP. It's expecting a local file reference (C:....).

You can embed the image in the message body though, using simple HTML:

<img src="http://SampleWebSite.com/Sample.asp?COMMAND=6" />