分享

写回答

发帖

[提问] [求助] 怎么能让Form Mail支持中文表单信息转发

GoDaddy GoDaddy 1603 人阅读 | 3 人回复

发表于 2010-2-4 11:47:45 | 显示全部楼层 |阅读模式

Form Mail 官方安装教程:http://help.godaddy.com/article/512#gdform

已经添加好这个功能,用的是gdform.php
经过测试,网页提交表单信息能够成功转入邮箱,
但是不支持中文,表单中文信息都显示“?”。

求助高手,如何解决中文显示问题。

回答|共 3 个

add.c

发表于 2010-2-4 14:11:48 | 显示全部楼层

发送的时候指定编码即可

castiel

发表于 2010-2-4 19:38:12 | 显示全部楼层

谢谢add.c
   不好意思~ 偶不会写程序...
查了些资料,
尝试asp的用邮件组件发送,
设置编码是utf-8,
加上"objMail.SetLocaleIDs(65001) " 这句提交就显示500服务器错误,
去掉这句发送成功,乱码依旧....
另外还有原样输出的问题,怎么在组件里实现换行或者回车符呢..
请高手帮忙看下,怎么修改。非常感谢!
源码如下:

<%@ CODEPAGE=65001 %>
<% Response.CodePage=65001%>
<% Response.Charset="UTF-8" %>

<%
dim xm,email,comments,dm
xm=trim(request.form("xm"))
email=trim(request.form("email"))
comments=trim(request.form("comments"))
dm=now()

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


' Create and send the mail
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From="service@hi12.info"
objMail.SetLocaleIDs(65001)
objMail.ReplyTo="service@hi12.info"
objMail.To="hello@hi12.net"
objMail.Subject=""& xm &"的留言"
objMail.TextBody="Name:"& xm &"& vbcrlf&_ Email:"& email &"& vbcrlf&_ Comments:"& comments &" & vbcrlf&_ Date:"& dm &""
objMail.Send


if Err <> 0 then
response.write "<font color=ff0000>"&Err.Description&"</font>"
else
Response.Write "邮件发送成功!"
response.end
end if
Set objMail = Nothing
%>

castiel

发表于 2010-2-4 21:26:17 | 显示全部楼层

发送编码问题已解决:

' Create and send the mail
Set objMail=CreateObject("CDO.Message")
Set objBodyPart=objmail.BodyPart 'Create BodyPart
' Use the config object created above
Set objMail.Configuration=objConfig
objBodyPart.Charset="UTF-8" 'Set relevant Charset
objMail.From="service@hi121.info"
objMail.ReplyTo="service@hi121.info"
objMail.To="hello@hi121.net"
objMail.Subject="来自网站的留言"
objMail.HTMLBody="Name:"& xm &"<br/>Email:"& email &"<br/>Comments:"& comments &"<br/>Date:"& dm &""
objMail.Send

只是GB2312的邮箱显示乱码。
您需要登录后才可以回帖 登录 | 注册

本版积分规则