Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Smtp email
Message
 
À
16/02/2007 08:45:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Titre:
Divers
Thread ID:
01196470
Message ID:
01196688
Vues:
13
Here is a sample using the System.Net.Mail classes of the .NET Framework.
DO SendNetMessage

PROCEDURE SendNetMessage
LOCAL oMsg
cYourAddress = "youruser@yourmail.com"
cYourUser = "youruser@yourmail.com"
cYourPassword = "yourpassword"

oClient = CLRCreateObject("System.Net.Mail.smtpclient")
oMsg = CLRCreateObject("System.Net.Mail.MailMessage")

* Creates an attachment
oAttachment = CLRCreateObject("System.Net.Mail.Attachment","c:\negocios\test.xls")

oMsg.Attachments.Add(oAttachment)

oMsg.From = CLRCreateObject("System.Net.Mail.MailAddress",m.cYourAddress)

oSenderAddress = CLRCreateObject("System.Net.Mail.MailAddress",m.cYourAddress)

oMsg.Subject = "This day of Valentine"
oMsg.body = FILETOSTR("c:\negocios\valentine-2007.txt")

* This is to authenticate with the SMTP server
oCredentials = CLRCreateObject("System.Net.NetworkCredential",m.cYourUser,m.cYourPassword)
oClient.Host = "localhost"

oClient.Credentials = oCredentials

m.cToAddress = "toAddress@ToServer.com"

oToAddress = CLRCreateObject("System.Net.Mail.MailAddress",m.cToAddress)
oMsg.To.Clear()
oMsg.to.Add(m.oToAddress)
WAIT WINDOW "Sending "+m.cToAddress NOWAIT
oClient.Send(oMsg)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform