By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Code to send mail ..

P: n/a
Hello all,
I a struggling for a few days now to find a way to send automated mail. I
succeeded except that MS Outlook always gives me those 2 stupid warnings
that 1) a "program tries to get access
to the emailadresses in the contactlist - and wether I want to allow this"
and 2) That a program is trying to send emails on my behalf - and wether I
want to allow this. ... I have tried to use the redemption package but
obviously I do not understand enough of it ..
I was thinking of making Outlook Express the default email prog - so maybe
that one does not give me those warnings;
Does anyone have an old code he would like to share that would send a set of
variables (mailadress, subject, body ...) to the default e-mail prog. (Thus
in this case Outlook Express)
Any help very much appreciated ...
Thanks
Ronny Sigo

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Ronny Sigo" <ro********@example.invalid> wrote in
news:3f***********************@reader1.news.skynet .be:
Hello all,
I a struggling for a few days now to find a way to send automated mail.
I succeeded except that MS Outlook always gives me those 2 stupid
warnings that 1) a "program tries to get access
to the emailadresses in the contactlist - and wether I want to allow
this" and 2) That a program is trying to send emails on my behalf - and
wether I want to allow this. ... I have tried to use the redemption
package but obviously I do not understand enough of it ..
I was thinking of making Outlook Express the default email prog - so
maybe that one does not give me those warnings;
Does anyone have an old code he would like to share that would send a
set of variables (mailadress, subject, body ...) to the default e-mail
prog. (Thus in this case Outlook Express)
Any help very much appreciated ...
Thanks
Ronny Sigo


IMO using an interactive e-mail client such as Outlook Express or that
resident in Outlook is inefficient. (I've written procedures doing so, but
not since I first worked with CDO.)

If your OS is Win 2000 or greater then CDO may be the solution for your
problem. A description of CDO can be found at:
<http://msdn.microsoft.com/library/de...n-us/dncdsys/h
tml/cdo_roadmap.asp>

This is a JScript manifestation of CDO code. (Sorry, I have some in VBA
but itís lost in the archives, somewhere).

var iCfg=new ActiveXObject('CDO.Configuration');
var iMsg=new ActiveXObject('CDO.Message');

iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/sendusing'
)=2;
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver
port')=25;
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver
')='your smtp server';
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/smtpauthen
ticate')=1;
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/senduserna
me')='your user name';
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/sendpasswo
rd')='your password'; iCfg.Fields.Update();

iMsg.Configuration=iCfg;

iMsg.From='your email address';
iMsg.Subject='Test';
iMsg.TextBody='This is Lyle\'s JScript code';
iMsg.TextBody+='\n\n\Rename extension to "jse" to make "runnable".';
iMsg.AddAttachment('f:/WindowsScripts/email.txt');
iMsg.To='e\-mail address of recipient';
iMsg.Send();
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2

P: n/a
Thanks for responding Lyle
I managed, with only one problem left. See next post if you like
Greetings :)
"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.4...
"Ronny Sigo" <ro********@example.invalid> wrote in
news:3f***********************@reader1.news.skynet .be:
Hello all,
I a struggling for a few days now to find a way to send automated mail.
I succeeded except that MS Outlook always gives me those 2 stupid
warnings that 1) a "program tries to get access
to the emailadresses in the contactlist - and wether I want to allow
this" and 2) That a program is trying to send emails on my behalf - and
wether I want to allow this. ... I have tried to use the redemption
package but obviously I do not understand enough of it ..
I was thinking of making Outlook Express the default email prog - so
maybe that one does not give me those warnings;
Does anyone have an old code he would like to share that would send a
set of variables (mailadress, subject, body ...) to the default e-mail
prog. (Thus in this case Outlook Express)
Any help very much appreciated ...
Thanks
Ronny Sigo
IMO using an interactive e-mail client such as Outlook Express or that
resident in Outlook is inefficient. (I've written procedures doing so, but
not since I first worked with CDO.)

If your OS is Win 2000 or greater then CDO may be the solution for your
problem. A description of CDO can be found at:

<http://msdn.microsoft.com/library/de...n-us/dncdsys/h tml/cdo_roadmap.asp>

This is a JScript manifestation of CDO code. (Sorry, I have some in VBA
but it's lost in the archives, somewhere).

var iCfg=new ActiveXObject('CDO.Configuration');
var iMsg=new ActiveXObject('CDO.Message');

iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/sendusing' )=2;
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver port')=25;
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver ')='your smtp server';
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/smtpauthen ticate')=1;
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/senduserna me')='your user name';
iCfg.Fields.Item('http://schemas.microsoft.com/cdo/configuration/sendpasswo rd')='your password'; iCfg.Fields.Update();

iMsg.Configuration=iCfg;

iMsg.From='your email address';
iMsg.Subject='Test';
iMsg.TextBody='This is Lyle\'s JScript code';
iMsg.TextBody+='\n\n\Rename extension to "jse" to make "runnable".';
iMsg.AddAttachment('f:/WindowsScripts/email.txt');
iMsg.To='e\-mail address of recipient';
iMsg.Send();
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.