I want to send mail in WSH with JScript source...What am I doing wrong 
Author Message
 I want to send mail in WSH with JScript source...What am I doing wrong

Hi,

I'm a newbie to WSH and have some experience on VBScript and JScript.

I want to know my HOME pc's IP address and send it to my mail box.

Cause my HOME pc uses DHCP service, its IP address changes on every booting event.

I was successful to get IP address but sending mail only fails all the time.

See below source..

///////////////////////////////////////////////////////////////////////////

omapi = new ActiveXObject("MAPI.Session");
omapi.Logon("Administrator");

objmsg = omapi.Outbox.Messages.Add();
objmsg.Subject = "Local IP Address";
objmsg.Text = msg;

objRecip = objmsg.Recipients.Add();

objRecip.Type = 1;
objRecip.Resolve();

var err = objmsg.Send();

e = objMsg.Send();

///////////////////////////////////////////////////////////////////////////

Looks very simple but it just won't work.

On my pc Outlook Express intalled and Microsoft Outlook 2000 installed.

And default mail client is OE.

I've debugged this, and found that on first line an error occurs.

<<"omapi = new ActiveXObject("MAPI.Session");"---->first line..>>

Error message just says that

"Microsoft JScript Run-time Error : Automation server can not create object."

This interpretation of error could somewhat different to original, but I guess

this is sufficient to you gurus for figure out what's going on. :-)

What am I doing wrong?

Please help. Thanks in advance.

Regards,
 Ryan



Sat, 01 May 2004 13:11:39 GMT  
 I want to send mail in WSH with JScript source...What am I doing wrong
Hi
Here is a tested code. Though in vbs, you'll know.

set s=createobject("msMapi.mapiSession")
 s.downloadMail=false
s.signon
 s.newSession=true
 set m=createobject("msMapi.mapiMessages")
 m.sessionId=s.sessionId
 m.compose

 m.msgSubject="subj"
 m.msgNoteText="body"
 m.send
s.signoff
 s.newsession=false
set m=nothing
set s=nothing

Quote:
> omapi = new ActiveXObject("MAPI.Session");
> omapi.Logon("Administrator");

> objmsg = omapi.Outbox.Messages.Add();
> objmsg.Subject = "Local IP Address";
> objmsg.Text = msg;

> objRecip = objmsg.Recipients.Add();

> objRecip.Type = 1;
> objRecip.Resolve();

> var err = objmsg.Send();

> e = objMsg.Send();

///////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:

> Looks very simple but it just won't work.

> On my pc Outlook Express intalled and Microsoft Outlook 2000 installed.

> And default mail client is OE.

> I've debugged this, and found that on first line an error occurs.

> <<"omapi = new ActiveXObject("MAPI.Session");"---->first line..>>

> Error message just says that

> "Microsoft JScript Run-time Error : Automation server can not create
object."

> This interpretation of error could somewhat different to original, but I
guess

> this is sufficient to you gurus for figure out what's going on. :-)

> What am I doing wrong?

> Please help. Thanks in advance.

> Regards,
>  Ryan



Sat, 01 May 2004 13:44:02 GMT  
 I want to send mail in WSH with JScript source...What am I doing wrong

Hi,

I was able to convert your advisory code fragment into mine.

And your method works just like a charm. :-)

Thanks.

Regards,
 Ryan

-p.s Korean? Maybe this is the first time that I ever get a hand from my people. ;-)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 01 May 2004 15:55:15 GMT  
 I want to send mail in WSH with JScript source...What am I doing wrong
var theShell = WScript.CreateObject("WScript.Shell");

var ipAddress = ""; // TODO Get IP Address


var theSubject = "IP Address";
var theBody    = "My IP Address is " + ipAddress;

var theCommand = "IExplore.exe mailto:" + theTo + "?subject=" + theSubject +
"&attachment=" + theBody;

theShell.Run(theCommand, 2);


Quote:
> Hi,

> I'm a newbie to WSH and have some experience on VBscript and JScript.

> I want to know my HOME pc's IP address and send it to my mail box.

> Cause my HOME pc uses DHCP service, its IP address changes on every
booting event.

> I was successful to get IP address but sending mail only fails all the
time.

> See below source..

///////////////////////////////////////////////////////////////////////////
Quote:

> omapi = new ActiveXObject("MAPI.Session");
> omapi.Logon("Administrator");

> objmsg = omapi.Outbox.Messages.Add();
> objmsg.Subject = "Local IP Address";
> objmsg.Text = msg;

> objRecip = objmsg.Recipients.Add();

> objRecip.Type = 1;
> objRecip.Resolve();

> var err = objmsg.Send();

> e = objMsg.Send();

///////////////////////////////////////////////////////////////////////////

- Show quoted text -

Quote:

> Looks very simple but it just won't work.

> On my pc Outlook Express intalled and Microsoft Outlook 2000 installed.

> And default mail client is OE.

> I've debugged this, and found that on first line an error occurs.

> <<"omapi = new ActiveXObject("MAPI.Session");"---->first line..>>

> Error message just says that

> "Microsoft JScript Run-time Error : Automation server can not create
object."

> This interpretation of error could somewhat different to original, but I
guess

> this is sufficient to you gurus for figure out what's going on. :-)

> What am I doing wrong?

> Please help. Thanks in advance.

> Regards,
>  Ryan



Wed, 05 May 2004 03:28:38 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. I want to send mail in WSH with JScript source...What am I doing wrong

2. onkeypress - what am i doing wrong

3. newbie - what am I doing wrong?

4. What am I doing wrong?

5. What I am doing wrong.

6. exitserver and settransfer, what am I doing wrong?

7. What am I doing wrong here?

8. What am i doing wrong here????? HELP

9. Recordset object, what am i doing wrong?

10. What am I doing wrong??

11. What am I doing wrong?

12. WMI: what am I doing wrong?

 

 
Powered by phpBB® Forum Software