无法使用经典的asp - mad mad

时间:2015-11-30 19:36:11

标签: asp-classic smtp

我真的在努力学习一些非常基础的东西,需要一些帮助,因为它不是来自godaddy的支持!

由于某种原因,以下代码不会发送任何电子邮件。

代码似乎是执行属性并且用很多调试消息来填充它但是没有帮助!

Te"来自"电子邮件地址有效且没有问题!有任何想法吗?端口?

欢呼,杰伊

<%

Dim objNewMail
Set objNewMail = Server.CreateObject("CDO.Message")

objNewMail.From = "info@example.com" 
objNewMail.To   = "info@example.com" 
objNewMail.Subject = "Interesting property sent by xxx"
objNewMail.TextBody = "Click the following link to see the property :" '& vbcr & vbcr & "http://www.maltawide.eu/default.asp?pid="

' GoDaddy SMTP Settings
'I had to remove the smpt settings as I dont have enough rep to post two links!

Response.Write ("Message sent successfully!")

%>

1 个答案:

答案 0 :(得分:-1)

我不确定您的邮件失败的原因,但这里是来自GoDaddy托管的工作邮件表单的代码。您需要做的就是构建表单页面以提交脚本中使用的表单字段,或者更改脚本中的表单字段名称以匹配现有表单,或者使用字符串替换表单。表格输入和指定变量值的示例包含在示例&#39; s&#39;创建代码的消息部分。

<%
Dim strBody
Dim strToAddress
Dim strFromAddress
Dim strReplyAddress
Dim strBlindCC

' Create the message
strBody = Request.Form("Message")
strToAddress = Request.Form("ToAddress")
strFromAddress = Request.Form("FromAddress")
strReplyAddress  = "NoReply@WebSite.com"
strBlindCC = "BlindCC@WebSite.com"  



' Include the schemas
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"


' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
objConfig.Fields.Update


' Send the message
Set objMail=CreateObject("CDO.Message")
Set objMail.Configuration=objConfig

objMail.From=strFromAddress 
objMail.ReplyTo=strReplyAddress

objMail.To=strToAddress

objMail.BCC=strBlindCC

objMail.Subject=strSubject

objMail.HTMLBody = strBody

objMail.Send

%>