ASP CDO Problems

B

belacyrf

Hey All, I have MDaemon running locally on the server, and that is
what I want to send mail through. It's a normal mail server which
doesn't require an access list, I just have a list of trusted IP's to
accept mail from.

This is the code I use on my ASP page

<%
'Send email using CDO.
Public Function sendEMail( fromAddress, toAddress, subject, body )
Dim outgoingSMTPServer, smtpUserID, smtpPassword
Dim objMail

'Trim all the parameter values.
fromAddress = Trim( fromAddress )
toAddress = Trim( toAddress )
subject = Trim( subject )

outgoingSMTPServer = ""
smtpUserID = ""
smtpPassword = ""

'outgoingSMTPServer = Application( "OutgoingSMTPServer" )
'smtpUserID = Application( "SMTPUserID" )
'smtpPassword = Application( "SMTPPassword" )

'Correct COX SMTP address.
outgoingSMTPServer = "127.0.0.1"

'Make sure that we have from, to address and body.
If fromAddress = "" Or toAddress = "" Or body = "" Then
sendEMail = False
Exit Function
End If

'Create the object.
Set objMail = Server.CreateObject( "CDO.Message" )

objMail.From = fromAddress
objMail.To = toAddress
objMail.Subject = subject
objMail.HTMLBody = body

'Send using the specified SMTP server.
objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/sendusing" ) =
2
'Name of the smtp server name.
objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpserver" )
= "localhost"
'Default port.
objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
) = 25

'Set the user ID and password if available.
If smtpUserID <> "" And smtpPassword <> "" Then
objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
) = 1

'Your UserID on the SMTP server
objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/sendusername"
) = smtpUserID

'Your password on the SMTP server
objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/sendpassword"
) = smtpPassword

objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpusessl"
) = False

objMail.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
) = 60
End If

'Update the configuration.
Call objMail.Configuration.Fields.Update()

'Send the message
Call objMail.Send()

'Release the object.
Set objMail = Nothing

sendEMail = True
Exit Function
End Function
%>

That function is in it's own asp page. I just include it when
necessary.
when I call the function and pass it the appropriate parameters, it
seems to go through without erroring, but of course I never get the
email, and the MDaemon logs dont even show an attempted connection.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top