Click to See Complete Forum and Search --> : Email Attachments from URL


shotsy247
02-06-2009, 09:22 AM
Hi All,

I see how I can send an email with an attachemtn using cdo, but all examples use at path like: objMessage.AddAttachment "c:\temp\readme.txt"

Is it possible to add an attachment like:

objMessage.AddAttachment "../attachments/readme.txt"

Thanks.

_t

downtime
02-06-2009, 11:29 AM
I've never tried to do this, but since you're targeting a file on your webserver, you should be able to get the physical path of your file fairly easily:

attachPathStr = Server.MapPath("../attachments/readme.txt")

objMessage.AddAttachment attachPathStr

Not sure if the parent path will work, but if not, you can probably figure out a way around that.

shotsy247
02-06-2009, 12:21 PM
Nice. I'll give that a try. I wasn't even thinking down that direction.

Although now that you bring that up, I think I have done that before and it did work.

Thanks.

_t