Jump to content
Server Maintenance This Week. ×

SendMail automation


This topic is 6494 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 by Guest
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

This topic is 6494 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.