Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending Emails from VFP
Message
 
À
12/04/2004 11:47:32
Mike Smith
Doncaster Office Services
Oakville, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00894077
Message ID:
00895722
Vues:
13
Mike,

check if you have the rights to send emails directly with SMTP. If you are using Outlook already you can be sure that the possibility is there. You may need to check this with someone who has configured you email server.
If you can use SMTP you could use CDO.
The code could look something like this:

Local iMsg,iConf
Declare SHORT InternetGetConnectedState In wininet.Dll;
INTEGER @lpdwFlags, Integer dwReserved
lConnect=displayState()
If lConnect
iMsg = Createobject("CDO.Message")
iConf = Createobject("CDO.Configuration")
Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 'smtp.xxx.com'
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
Endwith
TRY
With iMsg
.Configuration = iConf
.To = "What.Ever@WhereEver.com"
.CC = ""
.BCC = ""
.From = "ranjan.brahma@atosorigin.com"
.Subject = "This is test message"
.TextBody = "This message was sent by the SMTP server"
*.AddAttachment("c:\temp\email.zip") && Valid filename
.Send
Endwith
CATCH
MESSAGEBOX('Failed to send message, check its contents and/or the smtp server settings',0)
ENDTRY
iMsg = .Null.
iConf = .Null.
wb = .Null.
Else
Messagebox("Could not send the message, your connection is down.")
Endif

Procedure displayState
Local lConnected
lConnected = .F.
lpdwFlags = 0
If InternetGetConnectedState (@lpdwFlags, 0) = 1
lConnected = .T.
Endif
Return lConnected
Endproc

I didn't write this code myself but found it with Google. I think it came from FoxWiki.

Regards,

Ron


>I am using Tamar Ganor's Book "Microsoft Office Automation with VFP" to guide me on this and as you would expect the application part is working perfectly.
>
>But when VFP starts to interface with MS Outlook, a warning screen comes up saying "Someone is trying to access your Email Address File of MS Outlook". As long as I keep pressing YES, the email is eventually placed in the Outbox.
>
>I will be putting this on a person's computer who has asked for this feature so he won't want to see this message eash time.
>
>Is there some way of turning off this warning message?
>
>Mike Smith
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform