Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

CDOSYS SMTP

Question posted by: MM User (Guest) on August 3rd, 2008 01:05 PM
Hi,

I'm using CDOSYS for sending out emails, while designing my asp pages
locally I need to set the server to localhost, however for production I need
to set it to our smtp server (smtp.companyname.co.uk) is there a way to set
IIS to use the smtp server ?

Thanks

Anthony Jones's Avatar
Anthony Jones
Guest
n/a Posts
August 3rd, 2008
09:55 PM
#2

Re: CDOSYS SMTP
"MM User" <mmuser@microsoft.comwrote in message
news:ulAPnfW9IHA.4004@TK2MSFTNGP03.phx.gbl...
Quote:
Hi,
>
I'm using CDOSYS for sending out emails, while designing my asp pages
locally I need to set the server to localhost, however for production I

need
Quote:
to set it to our smtp server (smtp.companyname.co.uk) is there a way to

set
Quote:
IIS to use the smtp server ?


This is my stock CDOSYS emailling code:-

Option Explicit

Const cdoSendUsingMethod =
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer =
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPickupDirectory =
"http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"
Const cdoSMTPServerPort =
"http://schemas.microsoft.com/cdo/configuration/smtpserverport"

Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2

Dim oMsg : Set oMsg = CreateObject("CDO.Message")
Dim oConfig : Set oConfig = CreateObject("CDO.Configuration")

With oConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.companyname.co.uk"
.Item(cdoSMTPServerPort) = 25
.Update
End With

oMsg.From = "Me <me@mymail.myserver.com>"
oMsg.To = "Bloke <bloke@somewere.com>"
oMsg.Subject = "Test"
oMsg.HTMLBody = "<html><body>Hello World</body></html>"
Set oMsg.Configuration = oConfig

oMsg.Send

Note the SMTP server field here is being set using the server you specify.

--
Anthony Jones - MVP ASP/ASP.NET



 
Not the answer you were looking for? Post your question . . .
190,475 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors