Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending an email from within ActiveX script

Status
Not open for further replies.

markgrizzle

Programmer
Aug 3, 2003
288
US
Hi All:
When the SendEmail function is called, nothing happens. Can anyone tell me what's missing? If you haven't already guessed, I'm new to SQL Server (2000)
Thanks in advance,
Mark

Main()
...
Call SendEmail(msg)

End Function

Function SendEmail (msg)

Dim iMsg
Dim iConf
Dim flds

'use CDO Send Using Pickup in this example
Const cdoSendUsingPickup = 1

'use COM to create Message and Configuration Objects
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

'set the field to the configuration objects fields
Set flds = iConf.Fields

'set the field namespaces to variables/constants
With flds
.Item(" configuration/sendusing")
= cdoSendUsingPickup
.Item(" configuration/smtpserver")
= "smtp.xxx.com"
.Item(" configuration/smtpconnectiontimeout")
= 10
.Update
End With

' Apply the settings to the message.
With iMsg

Set .Configuration = iConf
.To = "xxx@xxx.com"
.From = "xxx@xxx.com"
.Subject = "Update Prod Data - Import tblTemplate DTS Package Failed"
.TextBody = msg
.Send

End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

End Function 'SendEmail
 
looking at my scripts that e-mail the only differences that I have are:
Code:
.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")=2[/URL]
	
'Server port
.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top