Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email through ShellExecute

Status
Not open for further replies.

ExtraD

Programmer
Jul 6, 2005
41
NL
Hi,

i found a piece of code on the internet and it seems to work ok accept its needs an SMTP service installed on the machine. now i saw some comments that you could also use a SMTP thats running on a server.
but how can i address this server?

this is the code i'm using:

Local lcFileName,lcStr && Variables locales
Declare Integer ShellExecute In "Shell32.dll" ;
INTEGER HWnd, ;
STRING lpVerb, ;
STRING lpFile, ;
STRING lpParameters, ;
STRING lpDirectory, ;
LONG nShowCmd
lcFileName = Sys(2015)+'.mht'
oMSG = Createobject("CDO.Message")

oMSG.To = gEmTo
WAIT WINDOW gEmTo
oMSG.From = gEmFrom
oMSG.Bcc = gEmBcc

oMSG.Subject = "Hello Email"

oMSG.AddAttachment(DRVPath + HtmlFax + '\' + gType2 + '\print\' + gName)

oMSG.TextBody = "Please see attachement for the details."

oMSG.Send()


thanx,
 
The following faq in my opinion shows the ideal way to send mail with foxpro but I did add to your code as you requested (see below) faq184-3840

LOCAL lcFileName,lcStr && Variables locales
Declare Integer ShellExecute In "Shell32.dll" ;
INTEGER HWnd, ;
STRING lpVerb, ;
STRING lpFile, ;
STRING lpParameters, ;
STRING lpDirectory, ;
LONG nShowCmd
lcFileName = Sys(2015)+'.mht'
oMSG = Createobject("CDO.Message")

oMSG.To = gEmTo
WAIT WINDOW gEmTo
oMSG.From = gEmFrom
oMSG.Bcc = gEmBcc

oMSG.Subject = "Hello Email"

oMSG.AddAttachment(DRVPath + HtmlFax + '\' + gType2 + '\print\' + gName)

oMSG.TextBody = "Please see attachement for the details."

oMsg.Configuration.Fields.Item(" && Send Using
oMsg.Configuration.Fields.Item(" &&SMTP SERVER
oMsg.Configuration.Fields.Item(" && PORT
oMsg.Configuration.Fields.Update
oMSG.Send()


Regards,

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top