Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send email programatically (outlook)
Message
From
08/07/2008 19:10:49
 
 
To
28/06/2008 07:06:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows NT
Miscellaneous
Thread ID:
01327391
Message ID:
01329858
Views:
22
>A better alternative would be to use CDO. With CDO you do not need to work-around the security patch.

Thank you all !!!!!
I realized that CDO is what I need. No need to mess with outlook.
After much research (I don't remember the sources though, sorry) this is what works for me:
(i hope this will work for all workstations, whether or not they have outlook or outlook express)
lcTo="username@mydomainname"
lcFrom="System"
lcSubject="CDO Mail"
lcTextBody="Sending email with CDO."
lcHTMLBody=""

*Define mail server name here
#DEFINE D_MailServerName "mail.mydomainname"

loMsg=CREATEOBJECT("CDO.Message")
IF VARTYPE(LoMsg)="O"
	liConfig=CREATEOBJECT("CDO.Configuration")
	IF VARTYPE(liConfig)="O"
		loFields=liConfig.Fields
		WITH loFields
			.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")=D_MailServerName
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")=90
			.Update
		ENDWITH
		
		*Define message properties
		WITH loMsg
			.Configuration=liConfig
			.To=lcTo
			.From=lcFrom
			.Subject=lcSubject
			
			*Use HTML Body text, if provided, otherwise use Text Body
			IF ! EMPTY(lcHTMLBody)
				.HTMLBody=lcHTMLBody
			ELSE
				.TextBody=lcTextBody
			ENDIF
			.Send
		ENDWITH
	ENDIF
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform