473,788 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("CDO.Confi guration")
objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
objConfig.Field s(cdoSMTPServer Port)=25
objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
Set objMail.Configu ration = objConfig

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

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

*************** ********
var objConfig = Server.CreateOb ject("CDO.Confi guration")
objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
objConfig.Field s(cdoSMTPServer Port)=25
objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
objConfig.Field s.Update ()

var objMail.Configu ration = objConfig
Feb 21 '07 #1
9 2944

"rvj" <rv*@rolemodels .netwrote in message
news:ug******** ******@TK2MSFTN GP03.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.CreateOb ject("CDO.Confi guration")
objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
objConfig.Field s(cdoSMTPServer Port)=25
objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
Set objMail.Configu ration = objConfig

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

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

*************** ********
var objConfig = Server.CreateOb ject("CDO.Confi guration")
objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
objConfig.Field s(cdoSMTPServer Port)=25
objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
objConfig.Field s.Update ()

var objMail.Configu ration = 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.SendUsingMe thod =
'http://schemas.microso ft.com/cdo/configuration/sendusing'
cdo.SMTPServer = 'http://schemas.microso ft.com/cdo/configuration/smtpserver'
cdo.SendUsingPo rt = 2

objConfig.Field s(cdo.SendUsing Method) = cdo.SendUsingPo rt


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**********@s pammotel.comwro te in message
news:12******** *****@corp.supe rnews.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=JSc ript%>
<!-- 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*@yadayadaya da.comwrote in message
news:OV******** ******@TK2MSFTN GP02.phx.gbl...
>
"Dave Anderson" <NY**********@s pammotel.comwro te in message
news:12******** *****@corp.supe rnews.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=JSc ript%>
<!-- 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******** ******@TK2MSFTN GP05.phx.gbl...
>

Anyway - thanks to both of you !!!!
I finally managed to send an email !!!
"Anthony Jones" <An*@yadayadaya da.comwrote in message
news:OV******** ******@TK2MSFTN GP02.phx.gbl...
>>
"Dave Anderson" <NY**********@s pammotel.comwro te in message
news:12******* ******@corp.sup ernews.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=JS cript%>
<!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
TYPE="TypeLi b" 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_OnS tart() 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**********@s pammotel.comwro te in message
news:ef******** ******@TK2MSFTN GP02.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_OnS tart() 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**********@s pammotel.comwro te in message
news:12******** *****@corp.supe rnews.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
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.