简体   繁体   English

经典的ASP邮件附件,如何上传到服务器

[英]Classic ASP email attachment, how to upload to server

Im currently using Classic ASP and developing my website with it.我目前使用经典 ASP 并用它开发我的网站。

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.只有当我的 IIS 服务器目录下有该文件时,我才能这样做。 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?我已经阅读了 asp 电子邮件附件和错误,但我意识到我需要先上传它? (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 服务器目录下,并且您应该拥有此文件夹/文件的所有权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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