Elijah Xu
Elijah Xu

Reputation: 51

Classic ASP email attachment, how to upload to server

Im currently using Classic ASP and developing my website with it.

I want to allow user to send a file regarding his/her comments to me.

I am able to do so only if i have the file under my IIS server directory. If its on the local like desktop or my other folders, it does not.

I have read up on asp email attachment and the errors and i realised that i need to upload it first? (correct me if im wrong).

Below are my codes. I have changed the details such like my server name and stuff with fake details.

Set cdoConfig = CreateObject("CDO.Configuration")  

    With cdoConfig.Fields  
        .Item(cdoSendUsingMethod) = cdoSendUsingPort
        .Item(cdoSMTPServer) = "my server name"  
        .Update  
    End With 

    Set cdoMessage = CreateObject("CDO.Message")
    strMsg ="Name: " & Request.Form("cName") & "<br>" & "Contact: " & Request.Form("cContactNumber") & "<br>" & "Email: " & Request.Form("cEmail") & "<br>" &   "Remarks: " & Request.Form("cRemarks")

    With cdoMessage 
        Set .Configuration = cdoConfig
        .From = "email"
        .To = "receiver email"
        .Cc = Request.Form("cEmail")
        .Subject = "[subject]"

        .Addattachment "\\IPAdress\file path\sampleFile.txt"
        .HTMLBody = strMsg
        .Fields.update
        .Send 
    End With 

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing

Can anyone help me? Or is there another way to go round this?

Your help will be appreciated! Thank you in advance!!

Upvotes: 1

Views: 1085

Answers (1)

Jinesh Jain
Jinesh Jain

Reputation: 1242

Yes this is true all files should be under your IIS server directory and you should have all rights on this folder/files..

Upvotes: 1

Related Questions