PDA

View Full Version : The "SendUsing" configuration value is invalid.


moiseszaragoza
09-15-2010, 05:50 PM
I am using JSScript
I am trying to send mail but i am having a err thar reads


The "SendUsing" configuration value is invalid.

My code

function SendEmail(to, subject, body) {
var recusr = Server.CreateObject("ADODB.Recordset");
var mail = Server.CreateObject("CDO.Message");

var objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailout.circletechfl.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 //'cdoSendUsingPickup
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
//objCDOSYSCon.Fields.Update
mail.Configuration = objCDOSYSCon


var arrEmTo = new Array();
var sql, page, str;
var cc = bcc = from = "";

// determine where the email goes
switch(to) {
case "administrators":
to = "lfoote@circletechfl.com, katief@circletechfl.com, stacyk@circletechfl.com";
cc = "support@circletechfl.com";

break;
case "managers":
sql = "SELECT email FROM vwUsers WHERE role IN(4)";
recusr = OpenRec(sql, page);
while(!recusr.EOF) {
arrEmTo[arrEmTo.length] = String(recusr("email"));
recusr.MoveNext();
}
recusr.Close();

to = arrEmTo;
cc = "support@circletechfl.com";
break;
case "testemail":
to = "support@circletechfl.com";
break;
case "support":
to = "support@circletechfl.com";
break;
default:
sql = "SELECT * FROM users WHERE userid='"+to+"'";
recusr = OpenRec(sql, page);
to = !recusr.EOF?String(recusr("email")):"";
recusr.Close();
//to = to;
}

// format data
str = "ONE [auto]: "+subject;
subject = InetFolder=="webapp-beta"?"TEST EMAIL: "+subject:str;
from = uEmail==""?"support@circletechfl.com":uEmail;

body = "<p><em>This email has been automated by the system.</em></p><p>"+body+"</p>";

// append to body
switch(to) {
case "support":
body += "";
break;
}

// send email
//mail.BodyFormat = 0; // 0 = HTML, 1 = Plain Text
//mail.MailFormat = 0; // 0 = MIME, 1 = Plain Text
//mail.Importance = 1; // 0 = Low, 1 = Normal, 2 = High
mail.To = to;
mail.Cc = "mZaragoza@circletechfl.com";
mail.Bcc = "mZaragoza@circletechfl.com";
mail.From = from; // session object (user email)
mail.Subject = subject;
mail.HTMLBody = body+" "+emFooter;


if(gblExecuteSql && gblEnableEmail && !blnDebugPage) {
try {
mail.Send();
Response.Write("<br> PASS <br>");
} catch(e) {
//SendEmail("support","Email Error ("+uid+")",e.message+"<p>To: "+to+"| Subject: "+subject+"<br>Body: "+body);
//Response.Redirect(page+"&emsg="+e.message);
Response.Write("<br> FAIL <br><strong>" + e.message + "</strong><br><br><br><hr>" );
}
} else {
//Response.Write("<p><strong>Email From:</strong> "+from+" | <strong>Email To:</strong> "+to+" | <strong>Email Cc:</strong> "+cc+" | <strong>Email Bcc:</strong> "+bcc+" <br><strong>Email Subject:</strong> "+subject+" <br><strong>Email Body:</strong> "+body+"</p>");
}


Response.Write(mail.To + " -- mail.To<br>");
Response.Write(mail.Cc + " -- mail.Cc<br>");
Response.Write(mail.Bcc + " -- mail.Bcc<br>");
Response.Write(mail.From + " -- mail.From<br>");
Response.Write(mail.Subject + " -- mail.Subject<br>");
Response.Write(mail.HTMLBody + " -- mail.HTMLBody<br>");

}
SendEmail("moisesz", "EMail Test Mail", "TEST MESSAGE Mail")

Old Pedant
09-15-2010, 07:20 PM
http://www.aspmessageboard.com/showthread.php?t=233957&page=2

moiseszaragoza
09-15-2010, 07:22 PM
thanks but did not help

Old Pedant
09-15-2010, 08:48 PM
Wait! Why is this commented out:

//objCDOSYSCon.Fields.Update

???

If you comment that out, I don't think the configuration is actually changed, at all, so of course it doesn't work.

Old Pedant
09-15-2010, 08:49 PM
In JScript code, it has to be a method *call* of course:
objCDOSYSCon.Fields.Update( );