分享

写回答

发帖

[提问] 有没有高人的程序用godaddy发送过邮件

GoDaddy GoDaddy 796 人阅读 | 1 人回复

发表于 2011-3-20 18:14:16 | 显示全部楼层 |阅读模式

求教
stmp地址 smtpout.secureserver.net 端口 80
发送邮件的时候报错
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

回答|共 1 个

lsok

发表于 2011-3-20 20:14:57 | 显示全部楼层

'发送邮件
mailbody="<html>"
mailbody=mailbody &"<body></body></html>"


'使用CDO发送邮件
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 objBodyPart = objmail.BodyPart 'Create BodyPart
objBodyPart.Charset = "gb2312" 'Set relevant Charset
Set objMail.Configuration=objConfig
objMail.From="email@yourdomain.com"  
objMail.To=email
objMail.Subject="邮件标题"
objMail.HtmlBody=mailbody

        
objMail.Send
Set objMail = Nothing
您需要登录后才可以回帖 登录 | 注册

本版积分规则