Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble with email
Message
From
23/04/2003 01:31:25
 
 
To
23/04/2003 00:44:48
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00780462
Message ID:
00780471
Views:
12
John

Since you use Win2k, you should forget using Outlook for your email. Pain in the B**t.

Use instead the CDO email object installed with WIN2k. The only essential in this case is that IIS is configured.

I use this code to send heaps of emails even as a NT service:

oMsg = CREATEOBJECT("CDO.Message")
IF TYPE("oMsg")#"O"
RETURN .F.
ENDIF
oMsg.To = tcTo
oMsg.From = tcFrom
oMsg.Subject = tcSubject
oMsg.TextBody = tcBody
oMsg.Send()
oMsg = NULL
RELEASE oMsg
RETURN .T.

Remember that IIS has to be setup as the CDO mail object needs this.

BErnard

>Hi,
>I know this an old subject but I just can't find the answer.
>If outlook is open all works well. If Outlook is not open and running the program hangs right after the "release oOutlook". Would someone please tell me why. TIA
>John
>
> I'm using VFP5, Outlook 2K on Win 2K with the following code:
>
>
>real_file = SYS(5) + SYS(2003) + "\" + filename && a text file I need to email (small)
>out_running= run32('OUTLOOK') && a program by George Tasker returns zero if no outlook
>
>if out_running = 0
> oOutlook = createObject("Outlook.Application")
>else
> oOutlook = getObject(,"Outlook.Application")
>endif
>if type('oOutlook') <>'O'
> =messagebox("unable to open Outlook - Returning to the printing program.",0,"Error")
> if file(real_file)
> delete file(real_file)
> endif
> return
>endif
>oMailItem = oOutlook.CreateItem(0)
>with oMailItem
> .subject = "Shipped Jobs"
> .Body = " Attached is a text file with a listing of Shipped Jobs"
> .Recipients.Add("jfabiani@yolo.com") &&"mayermgmt@csi.com"
>
>
>endwith
>
>
>oMailItem.Attachments.add(real_file)
>oMailItem.save()
>oMailItem.send()
>release oMailItem
>oOutLook.quit
>release oOutlook
>return
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform