简体   繁体   中英

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!!

是的,所有文件都应该在您的 IIS 服务器目录下,并且您应该拥有此文件夹/文件的所有权限。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM