473,382 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

javascript and email (part 2)

rvj

Ive come a cross another issue when trying to convert CDO VB to JS

The basic send generated the SendUsing configuration is invalid which I
understand means I have to specify the smpt server (amongst other
things)using the configuration object

**********************************

Set objConfig = Server.CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer)="smtp.server.co.uk "
objConfig.Fields(cdoSMTPServerPort)=25
objConfig.Fields(cdoSMTPAuthenticate)=cdoBasic
objConfig.Fields(cdoSendUserName) = "mxxxxxxxx-x"
objConfig.Fields(cdoSendPassword) = "xxxxxxxx"
Set objMail.Configuration = objConfig

************************

so do I assume that the following COM syntax should work with JS and
are the cdoconstants script independent ?

***********************
var objConfig = Server.CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer)="smtp.server.co.uk "
objConfig.Fields(cdoSMTPServerPort)=25
objConfig.Fields(cdoSMTPAuthenticate)=cdoBasic
objConfig.Fields(cdoSendUserName) = "mxxxxxxxx-x"
objConfig.Fields(cdoSendPassword) = "xxxxxxxx"
objConfig.Fields.Update ()

var objMail.Configuration = objConfig
Feb 21 '07 #1
9 2935

"rvj" <rv*@rolemodels.netwrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
>
Ive come a cross another issue when trying to convert CDO VB to JS

The basic send generated the SendUsing configuration is invalid which I
understand means I have to specify the smpt server (amongst other
things)using the configuration object

**********************************

Set objConfig = Server.CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer)="smtp.server.co.uk "
objConfig.Fields(cdoSMTPServerPort)=25
objConfig.Fields(cdoSMTPAuthenticate)=cdoBasic
objConfig.Fields(cdoSendUserName) = "mxxxxxxxx-x"
objConfig.Fields(cdoSendPassword) = "xxxxxxxx"
Set objMail.Configuration = objConfig

************************

so do I assume that the following COM syntax should work with JS and
are the cdoconstants script independent ?

***********************
var objConfig = Server.CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer)="smtp.server.co.uk "
objConfig.Fields(cdoSMTPServerPort)=25
objConfig.Fields(cdoSMTPAuthenticate)=cdoBasic
objConfig.Fields(cdoSendUserName) = "mxxxxxxxx-x"
objConfig.Fields(cdoSendPassword) = "xxxxxxxx"
objConfig.Fields.Update ()

var objMail.Configuration = objConfig
You are going to need to find the constant and enumeration values for all
the cdo members you want to use and create variables to hold them so that
code such as the above will work. For example

var cdo = {}

cdo.SendUsingMethod =
'http://schemas.microsoft.com/cdo/configuration/sendusing'
cdo.SMTPServer = 'http://schemas.microsoft.com/cdo/configuration/smtpserver'
cdo.SendUsingPort = 2

objConfig.Fields(cdo.SendUsingMethod) = cdo.SendUsingPort


Feb 21 '07 #2
"Anthony Jones" wrote:
You are going to need to find the constant and enumeration values
for all the cdo members you want to use and create variables to
hold them so that code such as the above will work.
No, he will not need to do that. He can use a TYPELIB declaration in
global.asa and drive right on as in his example.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Feb 22 '07 #3

"Dave Anderson" <NY**********@spammotel.comwrote in message
news:12*************@corp.supernews.com...
"Anthony Jones" wrote:
You are going to need to find the constant and enumeration values
for all the cdo members you want to use and create variables to
hold them so that code such as the above will work.

No, he will not need to do that. He can use a TYPELIB declaration in
global.asa and drive right on as in his example.

You're quite right. I was under the impression for some reason that only
worked in the VBScript environment but it does indeed work with JScript just
as well. Eg.:-

<%@language=JScript%>
<!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
TYPE="TypeLib" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
<%
Response.Write(cdoSMTPServer)
%>

If only one or two pages need the type library it might be better to just
place the METADATA directive in just those pages rather than in the
global.asa.

Feb 22 '07 #4
rvj


Anyway - thanks to both of you !!!!
I finally managed to send an email !!!
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:OV**************@TK2MSFTNGP02.phx.gbl...
>
"Dave Anderson" <NY**********@spammotel.comwrote in message
news:12*************@corp.supernews.com...
>"Anthony Jones" wrote:
You are going to need to find the constant and enumeration values
for all the cdo members you want to use and create variables to
hold them so that code such as the above will work.

No, he will not need to do that. He can use a TYPELIB declaration in
global.asa and drive right on as in his example.


You're quite right. I was under the impression for some reason that only
worked in the VBScript environment but it does indeed work with JScript
just
as well. Eg.:-

<%@language=JScript%>
<!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
TYPE="TypeLib" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
<%
Response.Write(cdoSMTPServer)
%>

If only one or two pages need the type library it might be better to just
place the METADATA directive in just those pages rather than in the
global.asa.

Feb 22 '07 #5
rvj
PS

Just out of interest does anyone know if its possible to turn off CDO
sender address checking (.From property) ?

From
E-mail address of the primary author of the message. This property is
optional; if left blank, the From property will be set to the value of the
Sender property, assuming a value for this property has been configured. If
neither the From property nor the Sender property is configured, the script
will fail.

It only appears to accept an "email type" syntax rather than plain text.
However most of the emails I recieve tend to have the From content in plain
text so I assume this is possible?.

"rvj" <rv*@rolemodels.netwrote in message
news:uS**************@TK2MSFTNGP05.phx.gbl...
>

Anyway - thanks to both of you !!!!
I finally managed to send an email !!!
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:OV**************@TK2MSFTNGP02.phx.gbl...
>>
"Dave Anderson" <NY**********@spammotel.comwrote in message
news:12*************@corp.supernews.com...
>>"Anthony Jones" wrote:
You are going to need to find the constant and enumeration values
for all the cdo members you want to use and create variables to
hold them so that code such as the above will work.

No, he will not need to do that. He can use a TYPELIB declaration in
global.asa and drive right on as in his example.


You're quite right. I was under the impression for some reason that only
worked in the VBScript environment but it does indeed work with JScript
just
as well. Eg.:-

<%@language=JScript%>
<!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
TYPE="TypeLib" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
<%
Response.Write(cdoSMTPServer)
%>

If only one or two pages need the type library it might be better to just
place the METADATA directive in just those pages rather than in the
global.asa.


Feb 22 '07 #6
Anthony Jones wrote:
If only one or two pages need the type library it might be
better to just place the METADATA directive in just those
pages rather than in the global.asa.
Better how?

I ask because it is not clear to me that there is a performance issue. After
all, Application_OnStart() is in global.asa, and it does not get used by
every page/request, so it occurs to me that the TYPELIB may simply be loaded
with the application. I understand that using the TYPELIB is more costly
than adovbs.inc (or equivalent) at runtime, but that would seem to be true
whether you put it directly in your script or in the global.asa, wouldn't
it?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Feb 22 '07 #7

"Dave Anderson" <NY**********@spammotel.comwrote in message
news:ef**************@TK2MSFTNGP02.phx.gbl...
Anthony Jones wrote:
If only one or two pages need the type library it might be
better to just place the METADATA directive in just those
pages rather than in the global.asa.

Better how?
It just doesn't make sense to modify a global resource for the benefit of
just one or two pages.
I ask because it is not clear to me that there is a performance issue.
After
all, Application_OnStart() is in global.asa, and it does not get used by
every page/request, so it occurs to me that the TYPELIB may simply be
loaded
with the application. I understand that using the TYPELIB is more costly
than adovbs.inc (or equivalent) at runtime, but that would seem to be true
whether you put it directly in your script or in the global.asa, wouldn't
it?
I'm surprised to hear that. I would have thought the use of adovbs.inc was
more expensive but I've never really looked into.


Feb 23 '07 #8
"Anthony Jones" wrote:
>I understand that using the TYPELIB is more costly than
adovbs.inc (or equivalent) at runtime, but that would seem
to be true whether you put it directly in your script or
in the global.asa, wouldn't it?

I'm surprised to hear that. I would have thought the use of
adovbs.inc was more expensive but I've never really looked
into.
Judge for yourself:
http://blogs.msdn.com/ericlippert/ar...22/430881.aspx

In particular, note Eric's acknowledgement that we often trade performance
for ease of use. I have absolutely no problem throwing ADO and CDO TYPELIB
declarations in my application roots because I never know A PRIORI if/where
I will need them.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Feb 23 '07 #9

"Dave Anderson" <NY**********@spammotel.comwrote in message
news:12*************@corp.supernews.com...
"Anthony Jones" wrote:
I understand that using the TYPELIB is more costly than
adovbs.inc (or equivalent) at runtime, but that would seem
to be true whether you put it directly in your script or
in the global.asa, wouldn't it?
I'm surprised to hear that. I would have thought the use of
adovbs.inc was more expensive but I've never really looked
into.

Judge for yourself:
http://blogs.msdn.com/ericlippert/ar...22/430881.aspx
A very interesting series of articles, thanks.
In particular, note Eric's acknowledgement that we often trade performance
for ease of use. I have absolutely no problem throwing ADO and CDO TYPELIB
declarations in my application roots because I never know A PRIORI
if/where
I will need them.
Ok I can see that point of view also make sense.

Feb 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.