Solved

CDO "SendUsing" Error

Posted on 2003-10-28
7
7,646 Views
Last Modified: 2007-12-19
I have this code to send email:

objMail = Server.CreateObject("CDO.Message");
objMail.To = "pedro@nitrgenio.net";
objMail.From = "pedro@galactica.pt";
objMail.Subject = "CDO Sample";
objMail.TextBody = "This is a test email using CDO";
objMail.Send();

and I get  this "SendUsing" error...

What's wrong?
0
Comment
Question by:pedropiedade
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 9636927
Try this

DIM iMsg, Flds, iConf

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

With iMsg
Set .Configuration = iConf
.To = "pedro@nitrgenio.net"
.From = "pedro@galactica.pt"
.Subject = "CDO Sample"
.HTMLBody = "This is a test email using CDO"
.Send
End With
0
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 9636943
Try this

DIM iMsg, Flds, iConf

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "REPLACE_WITH_IP_OF_YOUR_SMTP_SERVER"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAuthenticate) = cdoAnonymous ' 0
Flds.Update

With iMsg
Set .Configuration = iConf
.To = "pedro@nitrgenio.net"
.From = "pedro@galactica.pt"
.Subject = "CDO Sample"
.HTMLBody = "This is a test email using CDO"
.Send
End With
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9637585
replace

 > objMail = Server.CreateObject("CDO.Message");
with

 objMail = Server.CreateObject("CDONTS.NewMail");
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:pedropiedade
ID: 9641010
Please note that I'm useing Javascript.
I tried this:

      objMail = Server.CreateObject("CDO.Message");
      iConf = Server.CreateObject("CDO.Configuration");

      iConf.Fields("cdoSendUsingMethod") = "cdoSendUsingPort";
      iConf.Fields("cdoSMTPServer") = "169.254.173.128";
      iConf.Fields("cdoSMTPServerPort") = 25;
      iConf.Fields("cdoSMTPAuthenticate") = 0;
      iConf.Fields.Update();

      objMail.Configuration = iConf;
      objMail.To = "pedro@nitrgenio.net";
      objMail.From = "pedro@galactica.pt";
      objMail.Subject = "CDO Sample";
      objMail.TextBody = "This is a test email using CDO";
      objMail.Send();

But got the same error:

Tipo de erro:
CDO.Message.1 (0x80040220)
O valor de configuração "SendUsing" é inválido.
/sites/cdomail.asp, linha 43

(something like "The configuration value for "SendUsing" is not valid")

Any ideas?
0
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 9641259
Are you using Windows NT or 2000.

If you are using NT it would be CDONTS.

If you are using 2000 it would be CDO.
0
 
LVL 4

Accepted Solution

by:
dukestaTAI earned 50 total points
ID: 9641358
The error you are getting is a permission error.  The account you are using to send the message does not have sufficient rights to send the message.

This might help.

2.  Code Modification
In the case where a code modification is the preferred workaround, there are two ways of accomplishing the modification. You can use either cdoSendUsingPickup or cdoSendUsingPort.
2a.  cdoSendUsingPickup
Because cdoSendUsingPickup is the default value, it does not need to be specified; however, explicitly specifying it would make your code easier to read. The pickup directory does need to be specified.

Advantages
·      Greater application control of configuration.
·      Not restricted to first SMTP service instance.
Disadvantages
·      More fragile – installation of Exchange or administration configuration changes may cause the application to quit working because of changes to the location of the pickup directory.
·      Must configure local SMTP for relay.


Sample
The following code sample demonstrates setting cdoSendUsingPickup and the pickup directory’s location:

<%@ Language=VBScript %>
<%
   Dim iMsg
   Dim iConf
   Dim Flds  
   Const cdoSendUsingPickup = 1
   'For CDOSYS, the pickup directory is located at c:\inetpub\mailroot\pickup
   Const strPickup = "c:\Program Files\Exchsrvr\mailroot\vsi 1\Pickup"  

   'Create the message object
   Set iMsg = CreateObject("CDO.Message")  
   'Create the configuration object
   Set iConf = iMsg.Configuration  
   With iConf.Fields
      .item( "http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
      .item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = strPickup
      .Update
   End With
   'Set the message to,from,subject,body properties.
   With iMsg
      .To = "packerman@adatum.com"
      .From = "mbaker@adatum.com"
      .Subject = "Test message using CDOEx and cdoSendUsingPickup sent on: "  & now()
      .TextBody = "This is a test using CDOEx"
      .Send
   End With
   Set iMsg = Nothing
%>
 
0
 

Expert Comment

by:Zargoth
ID: 10105427
Ok,
Sendusing takes a number as a parameter not a string so "cdoSendUsingPort"; should be cdoSendUsingPort (which is a variable in a list you've included in your ASP file) or you could use the number 2 for the same option.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question