Jarron


Dear Expert,

Can I know how to connect to the Outlook Express and Microsoft Outlook using FoxPro

Like the data in a memo feild how I connect or send out using the Outlook Express and Microsoft Outlook

Or

Can I generete email using FoxPro

Thank you.

 

 




Re: Connect to Outlook Express and Microsoft Outlook

Alex Feldstein


Outlook Express Not directly. It is not a COM Server

MS Outlook Yes through COM Automation.

You take a reference with

oOutlook = CreateObject("Outlook.Application")

and then you have complete control of its object model. You can use an Object Browser and Intellisense to inspect the DOM.

http://fox.wikis.com/wc.dll Wiki~AutomationExamples

I higly recommend "Microsoft Office Automation with Visual FoxPro" by Tamar Granor and Della Martin, Hentzenwerke, ISBN 0-9655093-0-3
http://www.hentzenwerke.com/catalogavailability/autofox.htm

 

Email:

Craig Boyd's functions:
MAPI: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,8f569366-c76a-4873-9029-f31c07cf125e.aspx
MS Outlook: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,fb9e9267-3642-4176-94ea-9239691b61fa.aspx
CDO SYS: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,71acd54c-dcda-4dfa-b4ae-74854dd7947f.aspx
CDO NTS: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,40a6327a-44f7-4e98-9e83-cb50c2ebd4c1.aspx
Shell: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,0041d75b-ce37-4493-aac9-0db82b7317d5.aspx
WinExec: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,87d1b04e-afbf-4c41-9ba7-5bcef933128b.aspx
w3JMail: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,90d53f97-21a5-49b1-a0d7-0933c6eb62e5.aspx
BLAT: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,6b86dea6-66ec-4f8f-a610-73dd6f896fb7.aspx
EsSmtp: http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,def9a19f-04ab-46ff-8421-f700822f1773.aspx

See also:

http://fox.wikis.com/wc.dll Wiki~AutomatedEmail
http://fox.wikis.com/wc.dll Wiki~SendMapiEmail

COM Automation and Outlook sample:
#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2

oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)

WITH oEmailItem
   * use the recipiensts collection
   .Recipients.Add("
moe@3stooges.com")
   .Subject = "Automation with Outlook"
   .Importance = IMPORTANCENORMAL
   .Body = "SImple!"
   * note you need fullpath
   .Attachments.Add("c:\mydir\sample.txt")
   .Send
ENDWITH

RELEASE oEmailItem
RELEASE oOutLookObject






Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

Hi Jarron.

Can I know how to connect to the Outlook Express and Microsoft Outlook using FoxPro

In addition to the very detailed response you got from Alex, I would like to add that you can send e-mail using both Outlook and Outlook express using MAPI even though (as Alex correctly points out) Outlook Express is not an automatoin server. If you are running on Windows 2000 or later another good alternative for sending e-mail that does not depend on the e-mail client installed on the local machine is CDO for Windows 2000 or later. All this requires is access to an SMTP server either locally or on the network. Simple sample code:

*** create configuration and message objects< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

loConfig = CREATEOBJECT( 'CDO.Configuration' )

loMsg = CREATEOBJECT( 'CDO.Message' )

WITH loMsg

  .Configuration = loConfig

  .TO = 'Mickey@Mouse.com'

  .CC = 'Daffy@Duck.Com'

  .Bcc = 'Minnie@Mouse.com'

  .Subject = 'Sending e-mail vis CDO'

  *** Send a web page in the body of the message

  .CreateMHTMLBody( 'http://www.tightlinecomputers.com' )

  *** Add any message text to the beginning of the body

  .HTMLBody = 'This is a really cool web site<br>' + .HTMLBody

  *** Add an attachments

  .AddAttachment( 'c:\msoffice\winword\mydoc.doc' )

  .SEND()

ENDWITH

The biggest problem with using CDO is making sure that it is configured properly. The easiest way to do this is to make sure that Outlook Express is installed and confured properly for e-mail access on the client computer. You do not need to ever use Outlook Express, this just creates the necessary registry entries to correctly configure the CDO Confiuration object. Otherwise you will have to manually configure this configuraiton object.

Using CDO also gets around the Draconion Security Patch from h*ll which is an issue after wou apply the Service Packs to the OS and/or to Office

 

 

 

 

 







Re: Connect to Outlook Express and Microsoft Outlook

bankim

WITH THE ABOVE CODE I GOT THE FOLLOWING ERROR'

THE MESSAGE COULD NOT BE SENT TO THE SMTP SERVER.
THE TRANSPORT ERROR CODE WAS 0X80040217.
THE SERVER REPOSONSE WAS NOT AVAILABLE.




Re: Connect to Outlook Express and Microsoft Outlook

CetinBasoz

Bankim,

I don't know the answer.

Maybe you don't know but writing in uppercase is considered as "shouting at". Both Alex and Marcia are trying to help and they don't deserve to be shouted at. I believe you didn't know that rule:)

PS: I had the luxury to meet both of them in person and they are very nice people (nicer than you can think of - as many others in VFP community. Greetings to all of them with this opportunity:)





Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

bankim wrote:
WITH THE ABOVE CODE I GOT THE FOLLOWING ERROR'

THE MESSAGE COULD NOT BE SENT TO THE SMTP SERVER.
THE TRANSPORT ERROR CODE WAS 0X80040217.
THE SERVER REPOSONSE WAS NOT AVAILABLE.

Did you configure Outlook Express Can you send an e-mail successfully using Outlook Express






Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

CetinBasoz wrote:

PS: I had the luxury to meet both of them in person and they are very nice people (nicer than you can think of - as many others in VFP community. Greetings to all of them with this opportunity:)

Hi Cetin.

Aw, shucks! Hopefully we will have the chance to meet again f2f in the future






Re: Connect to Outlook Express and Microsoft Outlook

bankim

Yes,

I have configured the outlook express perfactly.

But unable to send the mail with CDO.

I have the code for microsoft outlook , but not for 'outlook express' & CDO code is not working and i go the above error.





Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

bankim wrote:

I have configured the outlook express perfactly.

Were you able to send an e-mail interactively using Outlook Express

bankim wrote:

I have the code for microsoft outlook , but not for 'outlook express' & CDO code is not working and i go the above error.

Outlook and Outlook Express are two separate products. I have no idea what you mean by this statement.






Re: Connect to Outlook Express and Microsoft Outlook

Aleniko

Marcia;

Can one use CDO if the SMTP server is an ISP






Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

Aleniko wrote:

Can one use CDO if the SMTP server is an ISP

You mean that the SMTP server is not installed locally

Absolutely, all you need to know is how to access the SMTP Server.

As I said earlier, the easiest way to do this is to configure Outlook Express correctly to create the necessary registry entries. Otherwise, you have to manually confiure CDO so that it can find the SMTP server.






Re: Connect to Outlook Express and Microsoft Outlook

bankim

I have configured the Outlook Express perfactly. & able to send/receive the mail from outlook express. But does not know how to auto use the outlook express from VFP code.Also how to use the CDO as i am totally new to this.



Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

bankim wrote:
But does not know how to auto use the outlook express from VFP code.Also how to use the CDO as i am totally new to this.

Please post the code that you are trying to use to send the e-mail and maybe we can help you debug it.






Re: Connect to Outlook Express and Microsoft Outlook

bankim

Sir,Please find the code as under & i am getting the error on send() command line.loConfig = CREATEOBJECT( 'CDO.Configuration' )loMsg = CREATEOBJECT( 'CDO.Message' )WITH loMsg .Configuration = loConfig .TO = 'bankim_mumbai@hotmail.com' .CC = 'bankim_mumbai@rediffmail.com' .Bcc = 'bankim_mumbai@indiatimes.com' .Subject = 'Sending e-mail vis CDO' *** Send a web page in the body of the message .CreateMHTMLBody( 'http://www.tightlinecomputers.com' ) *** Add any message text to the beginning of the body .HTMLBody = 'This is a really cool web site<br>' + .HTMLBody *** Add an attachments .AddAttachment( 'f:\B2\DMAT\TEMP.TXT' ) .SEND()ENDWITH



Re: Connect to Outlook Express and Microsoft Outlook

MarciaAkins

bankim wrote:
Sir,Please find the code as under & i am getting the error on send() command line

Are you connected to the internet when executing this code