File: D:/web/itpartnership/inc-email.asp
<%
' NOT TO BE TOUCHED BY SOCK (JEETS)'
Option Explicit
Dim NL
NL = Chr(13) + Chr(10)
Dim FEmailType, FPlainTextHeadingSpaces, FBody, FTableStyle
FEmailType = "HTML" ' can be set to also be set to "PLAIN" '
FPlainTextHeadingSpaces = 0
FTableStyle = _
"td {" &_
"font-family: Verdana, Arial, Helvetica, sans-serif;" &_
"font-size: 10px;" &_
"border-top-width: 1px;" &_
"border-right-width: 1px;" &_
"border-bottom-width: 1px;" &_
"border-left-width: 1px;" &_
"border-bottom-style: solid;" &_
"border-top-color: #CCCCCC;" &_
"border-right-color: #CCCCCC;" &_
"border-bottom-color: #CCCCCC;" &_
"border-left-color: #CCCCCC;" &_
"vertical-align: top;" &_
"}"
Sub SetTableStyle(ATableStyle)
FTableStyle = ATableStyle
End Sub
Sub OpenEmail(AType, APlainTextHeadingSpaces)
FBody = ""
FEmailType = AType
FPlainTextHeadingSpaces = APlainTextHeadingSpaces
If FEmailType = "HTML" Then
FBody = FBody & "<html>" & NL & "<head>" & NL
FBody = FBody & "<style type=""text/css"">" & NL & "<!--" & FTableStyle & "-->" & NL & "</style>" & NL
FBody = FBody & "</head><body>" & NL
FBody = FBody & "<table>" & NL
End If
End Sub
Sub AddToEmail(AHeading, AValue)
If FEmailType = "HTML" Then
FBody = FBody & NL & "<tr>" & NL
If AHeading = "" Then
FBody = FBody & "<td colspan=""2"">" & AValue & "</td>" & NL
Else
FBody = FBody & "<td>" & "<b>" & AHeading & "</b>" & "</td>" & NL
FBody = FBody & "<td>" & "<b>" & Replace(AValue, NL, "<br>") & " " & "</b>" & "</td>" & NL
End If
FBody = FBody & "</tr>" & NL
Else
If AHeading = "" Then
FBody = FBody & AValue & NL
Else
If Len(AHeading) >= FPlainTextHeadingSpaces Then
FBody = FBody & AHeading
Else
FBody = FBody & Left(AHeading & Space(FPlainTextHeadingSpaces), FPlainTextHeadingSpaces)
End If
FBody = FBody & ": " & AValue & NL
End If
End If
End Sub
Sub CloseEmail
If FEmailType = "HTML" Then
FBody = FBody & NL & "</table>" & NL
FBody = FBody & "
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4455167-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>" & NL & "</html>"
End If
End Sub
Sub SendEmail(ASubject, ATo, ABcc1, ABcc2, AFrom)
CloseEmail ' close the table tags etc because OpenEmail would have been called '
' send the email using Dundas Mailer Control '
Dim objEmail ' Mailer control '
Set objEmail = Server.CreateObject("Dundas.Mailer")
objEmail.SMTPRelayServers.Add "mail.itpartnership.com"
' set Mailer control properties and collection items '
objEmail.TOs.Add ATo
If ABcc1 <> "" Then objEmail.BCCs.Add ABcc1
If ABcc2 <> "" Then objEmail.BCCs.Add ABcc2
objEmail.FromAddress = AFrom
objEmail.Subject = ASubject
If FEmailType = "HTML" Then
objEmail.HTMLBody = FBody
Else
objEmail.Body = FBody
End If
objEmail.SendMail
' you can test for the success/failure of the operation by examining VBScripts Err object here '
Set objEmail = Nothing
End Sub
%>