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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Emails with CDOSYS 1

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
I need to be able to send emails from my webserver using ASP and I am using CDOSYS to do this. I have set up my Global.asa file as follows:

<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" -->

<SCRIPT RUNAT=Server LANGUAGE=VBScript>

' When the session start set the mail configuration options
Sub Session_OnStart()

' Declare required variables
Dim iConf, Flds

' Set the Configuration and Field objects
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' Set the configuration parameters
With Flds

.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mailserver"
.Update

End With

' Store the configuration as a Session variable
Set Session("Config") = iConf

End Sub

</SCRIPT>


The problem is that it will send internal emails but will not send external mails. Can anyone tell me how to fix this problem???

Mighty
 
I don't know anything about scripting in ASP, however, I do know a little VBScripting. In VBScripting, I would use the CDO.message and CDO.Configuration objects to send e-mails. Here my code:


Set omail=createobject(“cdo.message”)
Omail.to= Someone@microsoft.com
Omail.subject=”Test Mail from Script”
Omail.from=”script”
Omail.addtextbody=”script worked”
Omail.mimeformatted=false

OMail.Configuration.Fields.item(
OMail.Configuration.Fields.item(
OMail.Configuration.Fields.item(
Omail.send


Maybe this will help...

Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please check out (Sales@njcomputernetworks.com)
 
Joseph,

Thanks for the response. I have come to the conclusion that the problem is not with the CDOSYS configuration. The problem lies with the relaying on my Exchange server.

Mighty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top