CDOSYS SMTP

Discussion in 'ASP General' started by MM User, Aug 3, 2008.

  1. MM User

    MM User Guest

    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
    MM User, Aug 3, 2008
    #1
    1. Advertising

  2. "MM User" <> wrote in message
    news:...
    > 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 ?


    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 <>"
    oMsg.To = "Bloke <>"
    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
    Anthony Jones, Aug 3, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,050
    Roedy Green
    Jan 24, 2006
  2. Alex Hunsley
    Replies:
    4
    Views:
    3,410
    Tim Williams (gmail)
    Jun 29, 2004
  3. Raaijmakers, Vincent \(GE Infrastructure\)

    RE: sending of mail (smtp) - connection refused - but smtp serveris running!

    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    864
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
  4. =?Utf-8?B?Um9i?=

    SMTP Emailing with CDOSYS

    =?Utf-8?B?Um9i?=, Jul 9, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    307
    =?Utf-8?B?Um9i?=
    Jul 11, 2007
  5. rschaeferhig
    Replies:
    4
    Views:
    232
Loading...

Share This Page