|
|
|
|
Create an Email subroutine using CDOSYS
A good idea is to place the following subroutine in an include file
that holds all your website's subroutines and functions. (Learn more
about Include files)
<%
Sub SendEmail(sFrom, sTo, sSubject, sBody)
Dim sch, cdoConfig, cdoMessage
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2
.Item(sch & "smtpserver") = "127.0.0.1"
.Item(sch & "smtpserverport") = 25
.Item(sch & "smtpconnectiontimeout") = 60
.update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = sFrom
.To = sTo
.Subject = sSubject
.HTMLBody = sBody
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
End Sub
Call SendEmail("from@yoursite.com","recipient@theirsite.com","Hi","Just a test")
%>
If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site.
Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.
|
|
|
|
|