logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Mailing an Attachment with CDO


If you're coding in ASP, you often are using it to mail out messages, including attachments. This can be a great way to share files with your visitors.

The syntax is very straightforward. In a form, you request the email address of the user. Then in your processing script, you would use:

Email = request("email")

Set objMail= Server.CreateObject("CDO.Message")
With objMail
.From = "webmaster@yoursite.com"
.To = Email
.Subject = "File You Requested from SiteName"
.TextBody = "Here is the file you requested from SiteName"
.AddAttachment "C:\files\filename.pdf"
.Send
End With
Set objMail = Nothing

==========================

The beauty of this is that the actual file location - the c:\files\ - is NOT on the web anywhere. That directory is completely separate from your web directories. That means no web surfer anywhere can get to these files. Only the people who use your online forms can have the files sent to them. That gives you some level of security, that only people who should see the files can get them.

However, keep in mind that as soon as a user gets their hands on a file, they could easily forward it to friends. But you can't really help that. At some point you need to realize that if a user can see a file, they can steal it if they want to. Heck, people scan entire books into their computers sometimes (i.e. Harry Potter) to share with friends. So at some point you have to accept that you've done the best you can as far as protecting your files. If someone goes through the effort to steal your work at that point, it is out of your hands.

Just make sure that the sent file is well branded with your site name and information, so at least the file itself always indicates where it came from!
Add Mailing+an+Attachment+with+CDO to Twitter Add Mailing+an+Attachment+with+CDO to Facebook Add Mailing+an+Attachment+with+CDO to MySpace Add Mailing+an+Attachment+with+CDO to Del.icio.us Digg Mailing+an+Attachment+with+CDO Add Mailing+an+Attachment+with+CDO to Yahoo My Web Add Mailing+an+Attachment+with+CDO to Google Bookmarks Add Mailing+an+Attachment+with+CDO to Stumbleupon Add Mailing+an+Attachment+with+CDO to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor