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

发布于 2024-12-09 01:44:29 字数 1232 浏览 0 评论 0原文

我目前使用 Classic ASP 并用它开发我的网站。

我想允许用户向我发送有关他/她的评论的文件。

仅当我的 IIS 服务器目录下有该文件时,我才能执行此操作。 如果它位于本地(例如桌面或我的其他文件夹)上,则不会。

我已经阅读了 asp 电子邮件附件和错误,我意识到我需要先上传它? (如果我错了请纠正我)。

下面是我的代码。我已经更改了详细信息,例如我的服务器名称和带有虚假详细信息的内容。

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

谁能帮助我吗?或者还有其他方法可以解决这个问题吗?

我们将不胜感激您的帮助! 先感谢您!!

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静若繁花 2024-12-16 01:44:29

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文