经典ASP电子邮件附件,如何上传到服务器
我目前使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,确实如此,所有文件都应该位于您的 IIS 服务器目录下,并且您应该拥有此文件夹/文件的所有权限。
Yes this is true all files should be under your IIS server directory and you should have all rights on this folder/files..