谁有现成的代码,帮忙发一下,感激不尽
用Jmail或CDONTS来实现。
Public Function JmailSend(Email)
Dim Jmail
Set Jmail=Server.CreateObject("JMail.SMTPMail")
JMail.Charset=Email.Charset'定义邮件的字符集gb3212或gbk
JMail.ContentType=Email.ContentType'定义邮件的连接属性
JMail.ServerAddress=Email.SMTPServer'定义SMTP邮件发送服务器的地址
JMail.Sender=Email.MailSender'发件人地址
JMail.FromName=Email.MailFormName'发件人名称
JMail.Subject=Email.MailTitle'标题
JMail.AddRecipient Email.MailReceive'收件人E-Mail地址
JMail.Body=Email.MailBody'邮件内容
JMail.Priority=Email.Priority'优先级(是否是急件)
JMail.Execute'发送邮件
Set Jmail=Nothing'清空对象
'错误处理部分
IF Err.Number=0 Then
JmailSend="OK!"
Else
JmailSend=Err.Description
End IF
End Function
'CDONTS组件的邮件发送方法
Public Function CDONTSSend(Email)
On Error Resume Next
Dim CMial
Set CMail=Server.CreateObject("CDONTS.NewMail")
CMail.BodyFormat=0
CMail.MailFormat=0
CMail.From=Email.MailSender'发件人地址
CMail.To=Email.MailReceive'收件人地址
CMail.Subject=Email.MailTitle'邮件标题
CMail.Importance=Email.Priority'邮件优先级
CMail.Body=Email.MailBody'邮件内容
CMail.Send'发送邮件
Set CMail=Nothing
IF Err.Number=0 Then
CDONTSSend="OK!"
Else
CDONTSSend=Err.Description
End IF
End Function
参数是一个Email类里面的属性与代码写的相同。
Public Function JmailSend(Email)
Dim Jmail
Set Jmail=Server.CreateObject("JMail.SMTPMail")
JMail.Charset=Email.Charset'定义邮件的字符集gb3212或gbk
JMail.ContentType=Email.ContentType'定义邮件的连接属性
JMail.ServerAddress=Email.SMTPServer'定义SMTP邮件发送服务器的地址
JMail.Sender=Email.MailSender'发件人地址
JMail.FromName=Email.MailFormName'发件人名称
JMail.Subject=Email.MailTitle'标题
JMail.AddRecipient Email.MailReceive'收件人E-Mail地址
JMail.Body=Email.MailBody'邮件内容
JMail.Priority=Email.Priority'优先级(是否是急件)
JMail.Execute'发送邮件
Set Jmail=Nothing'清空对象
'错误处理部分
IF Err.Number=0 Then
JmailSend="OK!"
Else
JmailSend=Err.Description
End IF
End Function
'CDONTS组件的邮件发送方法
Public Function CDONTSSend(Email)
On Error Resume Next
Dim CMial
Set CMail=Server.CreateObject("CDONTS.NewMail")
CMail.BodyFormat=0
CMail.MailFormat=0
CMail.From=Email.MailSender'发件人地址
CMail.To=Email.MailReceive'收件人地址
CMail.Subject=Email.MailTitle'邮件标题
CMail.Importance=Email.Priority'邮件优先级
CMail.Body=Email.MailBody'邮件内容
CMail.Send'发送邮件
Set CMail=Nothing
IF Err.Number=0 Then
CDONTSSend="OK!"
Else
CDONTSSend=Err.Description
End IF
End Function
参数是一个Email类里面的属性与代码写的相同。