• 【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"
    %
    >
  • 相关阅读:
    JS 逻辑运算符&&与||的运算
    Jquery on("click") 方法绑定事件后执行多次解决办法
    java的web开发使用struts2/springMVC和spring框架理解
    HTTPClient
    eclipse中配置tomcat内存大小
    杀掉window占用端口
    Unirest
    乐观锁
    自定义标签
    xss和csrf攻击
  • 原文地址:https://www.cnblogs.com/amadeuslee/p/3744656.html
Copyright © 2020-2023  润新知