Send mail program with ASP

Source: Internet
Author: User

<!--#include file= "config.asp"-->
<!--#include file= ". /inc/email.asp "-->
<!--#include file= ". /inc/chkinput.asp "-->
<%
Dim newcloud_ads
Dim Rs
Dim SQL
Dim Nowstats
Dim HTMLTitle
Dim Style_css
Dim Htmltempstr
Dim Temptopstr
Dim Tempfootstr
Dim Boardtype
Dim Founderr
Dim errmsg
Dim ID
Dim sucmsg
Dim Topic
Dim Mailbody
Dim announce
Dim UserEmail
Articlendmail
Closeconn
Public Sub Articlendmail ()
On Error Resume Next
Newasp.loadtemplates ("")
Set newcloud_ads = Server.CreateObject ("Newcloudasp.admin_adcolumn")
Set Rs = Server.CreateObject ("Adodb.recordset")
Nowstats = "Mail package send"
HTMLTitle = "Mail package send"
Temptopstr = newasp.mainhtml (0) & newasp.mainhtml (1) & Newasp.mainhtml (2) & Newasp.mainhtml (3)
Tempfootstr = newasp.mainhtml (4)
STYLE_CSS = replace (replace (Newasp.style_css, "{$SetupDir}", Newasp.setupdir), "{$PICURL}", Newasp.tempdir)
Htmltempstr = Temptopstr
Htmltempstr = Replace (Htmltempstr, "{$NavMenu}", Newasp.sortingmenu)
Htmltempstr = Replace (Htmltempstr, "{$Width}", Newasp.mainset (0))
Htmltempstr = Replace (Htmltempstr, "{$Style _css}", Style_css)
If CInt (newasp.setting (5)) = 0 Then
Htmltempstr = Replace (Htmltempstr, "{$TopMeun}", Newasp.mainset (9))
Else
Htmltempstr = Replace (Htmltempstr, "{$TopMeun}", Newasp.mainset (10))
End If
Htmltempstr = Replace (Htmltempstr, "{$NowStats}", Nowstats)
Htmltempstr = Replace (Htmltempstr, "{$Title}", HTMLTitle)
Htmltempstr = Replace (Htmltempstr, "{$Adcolumn (0)}", Newcloud_ads.runscriptads (7))
Htmltempstr = Replace (Htmltempstr, "{$Adcolumn (1)}", Newcloud_ads.bannerads (7))
Htmltempstr = Replace (Htmltempstr, "{$Adcolumn (2)}", Newcloud_ads.adscolumn (7, 2))
Htmltempstr = Replace (Htmltempstr, "{$Adcolumn (3)}", Newcloud_ads.adscolumn (7, 3))
Response.Write Htmltempstr
Tempfootstr = Replace (Tempfootstr, "{$FootMeun}", Newasp.mainset (11))
Tempfootstr = Replace (Tempfootstr, "{$Width}", Newasp.mainset (0))
Tempfootstr = Replace (Tempfootstr, "{$Adcolumn (4)}", Newcloud_ads.scriptfloatads (7))
Tempfootstr = Replace (Tempfootstr, "{$Adcolumn (5)}", Newcloud_ads.scriptfixedads (7))
Response.Write "<table width=" ""
Response.Write Newasp.mainset (0)
Response.Write "" "Class=tableborder border=" "0" "align=" "Center" "cellpadding=" "0" "cellspacing=" "1" "class=" "border" ">"
Response.Write "<tr>"
Response.Write "<th> Mail package Send </th>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td valign=" "Top" "class=border2><br>"
Founderr = False
id = CLng (Request ("ID")
If not IsNumeric (ID) and id<> "" Then
Response.Write "Wrong system Parameters!" ID must be a number "
Exit Sub
Response.End
End If
If ID = "" Then
Founderr = True
ErrMsg = errmsg + "<br>" + <li> Please specify related articles </li> "
Exit Sub
End If
Set Rs = Server.CreateObject ("Adodb.recordset")
If Founderr Then
Call ErrorMsg
Else
Call ShowPage
End If
Response.Write "<BR>"
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table>"
Response.Write Tempfootstr
Set newcloud_ads = Nothing
End Sub
Private Sub ShowPage ()
On Error Resume Next
If Founderr Then
Call ErrorMsg
Else
If Request ("action") = "SendMail" Then
If IsValidEmail (Trim (Request.Form ("mail")) = False Then
ErrMsg = errmsg + "<br>" + "<li> your email has error!</li>"
Founderr = True
Else
UserEmail = Trim (Request.Form ("Mail"))
End If
If SendMail = "OK" Then
Call success
End If
Call Announceinfo
If Founderr Then
Call ErrorMsg
Else
Call success
End If
Else
Call Pag
End If
End If
If err.number <> 0 Then Err.Clear
End Sub
Private Sub Announceinfo ()
TOPIC = "You from" & Newasp.setting (0) & "sent the article information"
Mailbody = mailbody & "<style>a:visited {text-decoration:none}"
Mailbody = mailbody & "a:active {text-decoration:none}"
Mailbody = mailbody & "a:hover {text-decoration:underline overline}"
Mailbody = mailbody & "A:link {text-decoration:none;}"
Mailbody = mailbody & "a:visited {text-decoration:none;}"
Mailbody = mailbody & "a:active {text-decoration:none;}"
Mailbody = mailbody & "a:hover {text-decoration:underline overline}"
Mailbody = mailbody & "Body {font-family: XXFarEastFont-Arial; font-size:9pt;} "
Mailbody = mailbody & "TD {font-family: Song body; Font-size:9pt}</style> "
Rs.Open "Select title,content,infotime,writer from Nc_article where id=" & ID & "", Conn, 1, 1
If Rs.bof and Rs.eof Then
Founderr = True
ErrMsg = errmsg + "<br>" + "<li> no articles found related </li>"
Else
announce = announce & "<table border=0 width= ' align=center><tbody><tr> '"
announce = announce & "&LT;TD valign=middle align=top>"
announce = announce & "--&nbsp;&nbsp; Author:" & Rs ("writer") & "<br>"
announce = announce & "--&nbsp;&nbsp; release Time:" & Rs ("Infotime") & "<br><br>"
announce = announce & "--&nbsp;&nbsp;" & Rs ("title") & "<br>"
announce = announce & "" & Rs ("Content") & ""
announce = announce & "End If
Rs.close
Mailbody = Mailbody + announce
Mailbody = mailbody & "<center><a href=http://www.newasp.net> new Cloud Network </a>"
Select Case CInt (newasp.setting (10))
Case 0
Sucmsg = sucmsg + "Sorry! The system does not have mail enabled. "
Case 1
Call JMail (useremail, topic, mailbody)
Case 2
Call CDONTS (useremail, topic, mailbody)
Case 3
Call AspEmail (useremail, topic, mailbody)
Case Else
Sucmsg = sucmsg + "The system does not have mail enabled, please remember your registration information." "
End Select
If SendMail = "OK" Then
Sucmsg = sucmsg + "Congratulations, your parcel post was sent successfully." "
Else
Sucmsg = sucmsg + "Your package delivery did not succeed due to a system error." "
End If
End Sub
Private Sub Pag ()
Response.Write "<table cellpadding=0 cellspacing=0 border=0 width=460" "class=" "border"
Response.Write "<tr>"
Response.Write "<td class=border2>"
Response.Write "<table cellpadding=6 cellspacing=1 bgcolor= #CECECE border=0 width=" "100%" ">"
Response.Write "<form action=" "sendmail.asp?action=sendmail&id="
Response.Write ID
Response.Write "" "Method=post>"
Response.Write "<tr>"
Response.Write "<th valign=middle colspan=2 align=center>"
Response.Write "<b> Parcel Post </b></th></tr>"
Response.Write "<tr>"
Response.Write "<td class=border2 valign=middle colspan=2>"
Response.Write "<b> Package This article to the post. </b><br> Please enter the email address you want to post correctly! "
Response.Write "</td></tr><tr>"
Response.Write "<td class=border2><b> mail address:</b></td>"
Response.Write "<td class=border2><input type=text size=40 name=" "Mail" "></td>"
Response.Write "</tr><tr>"
Response.Write "<td colspan=2 class=border2 align=center><input type=submit value=" "Send" "name=" "Submit" "> </table></td></form></tr></table> "
End Sub
Private Sub Success ()
Response.Write "<table cellpadding=0 cellspacing=1 border=0 bgcolor= #CECECE width=460 align=center>"
Response.Write "<tr>"
Response.Write "<td class=" "Border2" ">"
Response.Write "<table cellpadding=3 cellspacing=1 border=0 width=" "100%" ">"
Response.Write "<tr align=" "Center" ">"
Response.Write "<th width=" "100%" "> Success: Parcel Post </th>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=" "100%" "class=" "Border2" ">"
Response.Write sucmsg
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr align=" "Center" ">"
Response.Write "<td width=" "100%" "class=" "Border1" ">"
Response.Write "<a href=" "Javascript:history.go ( -1)" "> << back to Previous page </a>"
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table> </td></tr></table>"
End Sub
Private Sub errormsg ()
Response.Write "<br>"
Response.Write "<table cellpadding=0 cellspacing=1 border=0 width=65% bgcolor= #CECECE align=center>"
Response.Write "<tr>"
Response.Write "<td class=" "Border2" ">"
Response.Write "<table cellpadding=3 cellspacing=1 border=0 width=" "100%" ">"
Response.Write "<tr align=" "Center" ">"
Response.Write "<th> error message </th>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=" "100%" "class=" "Border2" "><b> possible causes of error:</b><br><br>"
Response.Write ErrMsg
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "<tr align=" "Center" ">"
Response.Write "<td width=" "100%" "class=" "Border1" ">"
Response.Write "<a href=" "Javascript:history.go ( -1)" "> << back to Previous page </a>"
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table> </td></tr></table>"
End Sub
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.