# Using CDonts in ASP to send e-mail with attachment.



## Fyzbo (Feb 6, 2002)

I would like to know how to have a form on a webpage that will let a user include all the things needed for an e-mail(name, subject, body...) and then submit it to an ASP page and use CDonts to send the e-mail. Normally I would have no problem, but I want to let the user include a file attachment. It would be uploaded through the form. Is this possible, and if so how?


----------



## yul (Feb 11, 2003)

A file attachement can be added to an email message by uisng the AttachFile() method of the NewMail object.
The AttachFile () method accepts three parameters: the full file path of the file to send,optionally the name of the file as it will appear in the email message and the encoding method that should be used to encode the file:
eg:

thispage=Request.ServerVariables("PATH_TRANSLATED");

mymail=Server.CreateObject("CDONTS.Newmail");
mymail.AttachFile(thispage,"source")


----------

