[英]CDO.Message Classic ASP - Adding attachment
I am having problems trying to add an attachment to an email using Classic ASP. 我在尝试使用经典ASP向电子邮件添加附件时遇到问题。 I have trawled forums and it seems I needed to add .AddAttachment = "c:\\users\\samplb\\logoblack.gif" but the form doesn't work anymore.
我已经浏览了论坛,似乎我需要添加.AddAttachment =“ c:\\ users \\ samplb \\ logoblack.gif”,但是该表单不再起作用。 It comes up with the "The website cannot display the page" message.
它带有“网站无法显示页面”消息。
Here is my Code: 这是我的代码:
<%
name = request.form("name")
Message = request.form("Message")
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "xxx"
.Update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "test@me.co.uk"
.To = "test@me.co.uk"
.Subject = "Feedback / Suggestions"
.AddAttachment = "c:\users\samplb\logoblack.gif"
.TextBody = "Name: " & name & vbcrlf & vbcrlf & "Message: " & Message
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
Does anyone know why it might not be working? 有谁知道为什么它可能无法正常工作? When I take the .AddAttachment out the form works fine but I really need it to send the attachment.
当我取出.AddAttachment时,表单工作正常,但我真的需要它来发送附件。
The problem is .AddAttachment()
is a method not a property try changing your code like this; 问题是
.AddAttachment()
是一种方法,不是属性,请尝试像这样更改您的代码;
Call .AddAttachment("c:\users\samplb\logoblack.gif")
or to return the attachment as a CDO.BodyPart
use; 或将附件作为
CDO.BodyPart
使用返回;
Set cdoBodyPart = .AddAttachment("c:\users\samplb\logoblack.gif")
Note: See the AddAttachment Method (MSDN Library) for more information about the method and how to use it.
注意: 有关该方法及其使用方法的更多信息,请参见AddAttachment方法(MSDN库) 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.