MarshallSoft

FoxPro Email Example


* Connect to SMTP server then send email

Function SendMail(ToList, Subject, Message)
Local Kode
Local SmtpHost
Local SmtpUser
Local SmtpPass
Local SmtpFrom
Local SmtpRepl
y Local ccList
Local bccList
Local Attachments
SmtpHost = "smtp.my-isp.com"
SmtpUser = "my-user-name"
SmtpPass = "my-password"
SmtpFrom = "<mike@my-isp.com>"
SmtpReply= "<mike@my-isp.com>"
ccList = Chr(0)
bccList = Chr(0)
Attachments = Chr(0)
* specify the port to connect on (default port is 25)
seeIntegerParam(0, SEE_SMTP_PORT, 587)
* enable "SMTP Authentication"
Kode = seeIntegerParam(0, SEE_ENABLE_ESMTP, 1)
* specify the user name and password for SMTP authentication
seeStringParam(0, SEE_SET_USER, SmtpUser)
seeStringParam(0, SEE_SET_SECRET, SmtpPass)
* connect to SMTP server
Kode = seeSmtpConnect(0, SmtpHost, SmtpFrom, SmtpReply)
* error ? (negative return codes are errors)
if Kode < 0
  return Kode
endif
* send email to list of recipients (ToList)
Kode = seeSendEmail(0,ToList,ccList,bccList,Subject,Message,Attachments)
return Kode

MSC Logo

HOME PAGE
MARSHALLSOFT is a trademark of MarshallSoft Computing, Inc.