我正在使用CDO.Message发送邮件。当用户提交表单时,表单详细信息将发送给网站所有者,并向用户发送确认邮件。后者不适合我。我通过更改配置名称重复了两次相同的代码,我只是得到“内部服务器错误”
我的代码(邮寄给网站所有者)
<%
name = Request.Form ("name")
email = Request.Form ("email")
phone = Request.Form ("phone")
message = Request.Form ("message")
Dim iMsg, iConf, Flds, vSub
Response.CodePage = 65001
Response.CharSet = "utf-8"
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'sending email with Google Apps Premium SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "smtpserver") = "localhost"
Flds.Item(schema & "smtpserverport") = 25
Flds.Item(schema & "sendusername") = "info@priceakagri.ru"
Flds.Item(schema & "sendpassword") = "******"
Flds.Update
With iMsg
Set .Configuration = iConf
.BodyPart.Charset = "utf-8"
.To = "info@akagri.ru"
.From = "info@priceakagri.ru"
.Subject="Message from Priceakagri.ru contact page"
.HTMLBody="Здравствуйте! <br><br>You have received an Enquiry from <font color='#337AB7'><b>" & Trim(Request("name")) & "</b></font>.<br><br><br><table><tr><td width='30%' colspan='2' bgcolor='#337AB7'>Message Details</td></tr><tr><td>Name</td><td>" & Trim(Request("name")) & "</td></tr><tr><td>Email</td><td>" & Trim(Request("email")) & "</td></tr><tr><td>Phone</td><td>" & Trim(Request("phone")) & "</td></tr><tr><td>Message</td><td>" & Trim(Request("message")) & "</td></tr></table>"
Set .Configuration = iConf
.Send
End With
set iMsg = nothing
set iConf = nothing
set Flds = nothing
%>
以上代码对我来说非常适合。如果我复制它并在确认时向用户发送邮件,我会收到错误。我使用用户的电子邮件为.To和From as - info@priceakagri.ru
我在之前的网站上做过这个,我在后面加了一个.txt文件,但仍在为我工作。
需要帮助。
此致 巴德里