Vjeran Posted April 6, 2006 Posted April 6, 2006 (edited) Hi, Does anybody have a clue how to automatically send mail and close mail app (Outlook) on WinXP (SP2)? Thx in advance VJ Edited April 6, 2006 by Guest
Vjeran Posted April 6, 2006 Author Posted April 6, 2006 (edited) Here is VBS for sending mail automatically witout mail app and FMP: Set objEmail = CreateObject("CDO.Message") objEmail.From = "[email protected]" objEmail.To = "[email protected]" objEmail.Subject = "xxxx" objEmail.Textbody = "xxxx" objEmail.AddAttachment "c:xxx" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "your SMTP" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send Q: Any Idea how to conect with FMP records? VJ Edited April 6, 2006 by Guest
Wim Decorte Posted April 8, 2006 Posted April 8, 2006 Hi VJ, Different ways you can do this: - you can make an ODBC connection to FM8 - you can trigger a script in FM that will export a file and you read that file in your VBscript - dynamically create that VBscript from inside FM using data from whatever record you're on. This last approach is my favorite because it's fast and easy to set up.
Vjeran Posted April 8, 2006 Author Posted April 8, 2006 Danke Vim, I have other VBS to trigger FM script to export data launched by Win Scheduled task, but FM file have SetUp layout in which end user must enter email addresses, so idea is to have mail VBS which will take email addresses from FM file (mail records) and automaticly send mail on those addresses ... so, how to put connection with FM file in this mail VBS? :P
Wim Decorte Posted April 9, 2006 Posted April 9, 2006 It depends on how this fits in your solution. I typically store the VBscript syntax in a global field, with placeholders where the FM data needs to go (where the "xxx"'s are in your example). Then through a user action a script runs that: - populates another global with the final VBscript syntax substituting out the placeholders with real data - uses the "export field contents" script step to create the VBscript physically on the hard disk - use the "send event" script step to execute it - use another "send event" to delete the vbscript But if the VBScript is part of another process outside of FM then this may not be possible and you'll need to use ODBC in your VBscript to extract the data from FM.
Kevin Mortimer Posted July 14, 2006 Posted July 14, 2006 I have vb script I use to send mail. It works great but the email gets sent automaticaly. I have a client who does not want the email sent emmediately but mabe just sent to outbox untill he hits his send and receive button or to be sent to the drafts folder. How I do I change the VB script below to make this change. Dim App Dim Mail Set App = CreateObject("Outlook.application") Set Mail = App.CreateItem(0) Mail.To = "[email protected]" Mail.Cc = "" Mail.Bcc = "" Mail.Subject = "Attached CVs" Mail.Body = "Dear Natalie"+chr(13) _ +""+chr(13) _ +"Further to our conversation regarding the candidates for the role of , please find attached the following CVs, Natalie Rebecca Fullick."+chr(13) _ +""+chr(13) _ +"If you have any queries, please do not hesitate to contact me."+chr(13) _ +""+chr(13) _ +""+chr(13) _ +"Kind regards "+chr(13) _ +""+chr(13) _ +""+chr(13) Mail.Send Set Mail = Nothing Set App = Nothing Thanks for all the help. Kind Regards Kev
Wim Decorte Posted July 15, 2006 Posted July 15, 2006 Just off the top of my head but replace "mail.send" with "mail.save"?
Recommended Posts
This topic is 6749 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now