Wrox Programmer Forums
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 27th, 2003, 04:43 AM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems Sending email using CDONTS

I have a page written in asp and javascript. I'm trying to send an email using CDO.Message and when i run the page the error that occurs is:
[u]The SendUsing value is invalid.</u>
On the other hand i tried to send the email using CDONTS.NewMail and my error is
[u]Permission Denied.</u>
Here is my code for the two solutions.

  var Msg = new ActiveXObject("CDO.Message");
  var Config = new ActiveXObject("CDO.Configuration");
  Bp = Msg.BodyPart;
  configFlds = Config.Fields;
  var cdoSendUsingPort = 2;
  Flds = Bp.Fields;

  configFlds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "servername.somewhere.gr";
  configFlds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25;
  configFlds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;// CdoSendUsing enum value = 2
  configFlds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10;
  configFlds.Update();

   Flds("urn:schem=:mailheader:content-type") = micalg=SHA1";
   "text/plain; charset='iso-8859-1'";
   Flds("urn:schemas:mailheader:content-disposition")= "attachment;filename="+mid+".txt";
   Flds("urn:schemas:mailheader:content-transfer-encoding") = "";
   Flds("urn:schemas:httpmail:content-disposition-type") = "attachment";
   Flds("urn:schemas:mailheader:content-language") = "el";
   Flds("urn:schemas:mailheader:content-transfer-encoding") ="quoted-printable";
   Flds("urn:schemas:mailheader:content-transfer-encoding") ="7bit";


 Msg.To = "[email protected]";
 Msg.From = "[email protected]";
 Msg.Subject = "This is an auction";
 Msg.TextBody = "here is my file";
 Msg.AddAttachment("c:\\db\\dimitra\\myfile.txt");//saved on server
 Msg.Send();

And the code for my second solution is:

var CdoBodyFormatText = 1;
var CdoMailFormatText = 1;
var CdoEncodingBase64 = 1;
var CdoHigh = 2;
email = new ActiveXObject("CDONTS.NewMail");
email.To = "[email protected]";
email.From = "[email protected]";
email.Subject = "Hope you get this mail";
email.Body = "Yes now you are reading the contents of the mail";
email.BodyFormat = 1;
email.MailFormat = 1;
email.Importance = 2;
email.AttachFile("c:\\db\\dimitra\\member1\\Docs\\ 11.txt",1);
email.Send();
email = null;

As i read i had to check the configuration settings and i think that i have done that correctly.Moreover i have chechked the file and directory permissions and i have given read and execute.I use the CDONTS.dll

I do not know what else to do, so please help me. Any kind of information worths.
Thank you very much!:)

 
Old September 10th, 2003, 09:19 AM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

For the CDO mail, try adding this above the Msg.To line:

Msg.Configuration = Config

The Message has to have the Configuration set otherwise it fail and give you the error 'SendUsing value is invalid'

Digga






Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Net.Mail Problems With Sending An Email Doom C# 3 May 25th, 2008 02:49 PM
problems with sending email starfish2007 Pro PHP 0 June 6th, 2007 11:30 PM
Got problems with sending email using php HELP rongfu84 Beginning PHP 3 January 8th, 2006 10:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.