【Vegas原创】CDO发送邮件

<%
Group_ID
=Request("Group_ID")
on error resume next
'

Set Rs=Conn.Execute(Access)


While Not Rs.Eof

    
Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing"
    
Const cdoSendUsingPort=2
    
Const cdoSMTPServer="http://schemas.microsoft.com/cdo/configuration/smtpserver"
    
Const cdoSMTPServerPort="http://schemas.microsoft.com/cdo/configuration/smtpserverport"

    
Dim objConfig ' As CDO.Configuration
    Dim objMessage ' As CDO.Message
    Dim Fields ' As ADODB.Fields

    
Set objConfig = Server.CreateObject("CDO.Configuration")
    
Set Fields = objConfig.Fields

    
With Fields
        .Item(cdoSendUsingMethod) 
= cdoSendUsingPort
        .Item(cdoSMTPServer) 
= "***"
        .Item(cdoSMTPServerPort) 
= 25
        .Update
    
End With

    
Set objMessage = Server.CreateObject("CDO.Message")
    
Set objMessage.Configuration = objConfig

    MailTo
=Rs("M.Mail")
    MailFrom
=Rs("Account_Name"& "讯息通知<" & RS("M1.Mail"&">"
    MailSubject
="讯息通知: " & RS("Title")
    body
=Replace(RS("Description"),vbCrLf,"<BR>")
    
IF RS("Att_Files")<>"" OR RS("Att_Files2")<>"" OR RS("Att_Files3")<>"" OR RS("Att_Files4")<>"" OR RS("Att_Files5")<>"" Then
        body
=body & "<BR>※您的讯息通知有包含附件,详细内容请参阅EIP讯息通知。"
    
End IF

response.write MailTo 
& "<br>"
response.write MailFrom 
& "<br>"
response.write MailSubject 
& "<br>"
response.write body 
& "<br>"
'response.end

    
With objMessage
        .To 
= MailTo
        .From 
= MailFrom
        .Subject 
= MailSubject
        .HtmlBody 
=body
        .Send
    
End With



Rs.MoveNext
Wend

    
Set Fields = Nothing
    
Set objMessage = Nothing
    
Set objConfig = Nothing

Response.Redirect 
"Message_To_You_List.asp"
%
>

 

posted @ 2007-03-16 14:06  李济宏(Amadeus)  阅读(199)  评论(0编辑  收藏  举报