0

I'm programming Classic Asp with IIS8.5, so for sending email I use the SMTP Service (not the SMTP Server) with the CDO component. I want to send email using the pickup directory option:

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")      = 1 

So my code is:

Set objConfig = Server.CreateObject("CDO.Configuration")
        Set Fields = objConfig.Fields

        With Fields
         .Item("http://schemas.microsoft.com/cdo/configuration/sendusing")      = 1 
         .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")     = "smtp-relay.gmail.com"
         .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
         .Item("http://schemas.microsoft.com/cdo/configuration/sendusername")   = "xxx@gmail.com"
         .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")   = "The-pwd-123"
         .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")     = true
         .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")   = 1
         .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")  ="C:\inetpub\correos\"

         .Update
        End With

        Set objMessage = Server.CreateObject("CDO.Message")
        Set objMessage.Configuration = objConfig

        With objMessage
         .BodyPart.Charset = "unicode-1-1-utf-8"
         .To       = "YYY <yyy@gmail.com>"
         .From     = "XXX <xxx@gmail.com>"
         .Subject  = "This is a subject"
         .TextBody = "This is the body of the message"
         .Send
        End With

As you may know IIS8.5 come without SMTP Server, so there is no folder for the pickup directory (or I haven't found it yet), you must created, the problem I'm having is that the emails are getting stuck into the folder I created for that purpose.

https://support.google.com/a/answer/176600?hl=es

Artemination
  • 703
  • 2
  • 10
  • 30
  • Might seem obvious, but I have to ask... did you install the SMTP server service via the Add Roles and Features GUI or via PowerShell with `Install-WindowsFeature -name SMTP-Server` ? – Kev Mar 03 '15 at 11:29
  • Couldn't you just set sendusing to 2 and remove the need for a pickup directory. You can specify a remote smtp server. See this question http://stackoverflow.com/questions/9669644/send-mail-with-cdo-through-google-apps-gives-transport-error-cdo-message-1-erro – John Mar 03 '15 at 12:02
  • yes @John, I setted sendusing to 2 but the performance is very slow so I want to try with pickup directory.. – Artemination Mar 03 '15 at 12:41
  • Hi @Kev, I just installed IIS8.5 via Windows Features and .NET Framework 3.5 – Artemination Mar 03 '15 at 12:57

1 Answers1

1

When you use the cdoSendUsingPickup option, you are simply writing the email message to a file which will be queued up for delivery asyncronously from your code. Yes, this is dramatically faster as your code does not have to wait for the SMTP server to receive the message. So, when using this option, you do not need to specify the destination SMTP server, the port, the username, password, etc.

Hopefully you are now asking yourself how does the server know where to send the message to if I don't specify a forwarding SMTP server. Well, that's because you just have to configure the Microsoft SMTP Service to let it know what server to hand off the messages to. There are plenty of articles online to configure it so you should not have any trouble finding that.

dmarietta
  • 1,940
  • 3
  • 25
  • 32