只看楼主 楼主

发邮件的程序

<%
Sub sendemail(sendFrom,sendTO,smtpserver,sendusername,sendpassword,subject,message)
On Error Resume Next
set iConfg = CreateObject("CDO.Configuration")
Set oFields = iConfg.Fields
'oFields = iConfg.Fields
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")=sendFrom //sender mail
oFields.item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname")=sendFrom //email account
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendusername")=sendusername
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword")=sendpassword
oFields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
'value=0 代表Anonymous验证方式(不需要验证)
'value=1 代表Basic验证方式(使用basic (clear-text) authentication.
'The configuration sendusername/sendpassword or postusername/postpassword fields are used to specify credentials.)
'Value=2 代表NTLM验证方式(Secure Password Authentication in Microsoft Outlook Express)
oFields.item("http://schemas.microsoft.com/cdo/configuration/languagecode")=&H0804
oFields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver")=smtpserver
oFields.Update()

Set oMsg = Server.CreateObject("CDO.Message")
Set oMsg.Configuration = iConfg
oMsg.From = sendFrom
oMsg.To = sendTO
oMsg.Subject = subject
oMsg.HTMLBody = message
'set iConfg=CreateObject("CDO.IConfiguration")
'iConfg = oMsg.Configuration
'set oFields=CreateObject("ADODB.Fields")
'set iMsg = CreateObject("CDO.Message")
'oMsg.BodyPart.Charset="gb2312"
'oMsg.HTMLBodyPart.Charset="gb2312"
oMsg.Send()
if err.number<>0 then
Response.write "<center>邮件发送失败,请与管理员联系!</center>"
'response.end
end if

Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.Send smtpmail,mailaddress,mailtopic,body
Set MailObject=nothing

End Sub

Sub SendJmail(sendFrom,sendTO,smtpserver,sendusername,sendpassword,subject,message,SendName)
On Error Resume Next
Set JMail=Server.CreateObject("JMail.Message")
JMail.Charset="gb2312"
JMail.ContentType = "text/html"
jmail.from = SendFrom
jmail.silent = true
jmail.Logging = true
jmail.FromName = SendName
jmail.mailserverusername = sendusername
jmail.mailserverpassword = sendpassword
jmail.AddRecipient sendTO
jmail.body=message
JMail.Subject=subject
if not jmail.Send ( smtpserver ) then
SendMail="<center>由于系统错误,给您发送的操作记录未成功!</center>"
end if
response.Write SendMail
End Sub
%>
依旧87的签名
 
CHINAZ官方广告

 TOP

只看该用户 沙发

Re:发邮件的程序

很多系统都有配置了
ck87的签名

 TOP