From: mistral on
On 4 ���., 15:47, "Bart Perrier" <bart_perr...(a)hotmail.com> wrote:
> "mistral" <polych...(a)softhome.net> wrote in message
>
> news:1170545227.146523.308160(a)q2g2000cwa.googlegroups.com...
>
>
>
>
>
"Bart Perrier" <bart_perr...(a)hotmail.com> wrote:
> >> I have removed all of the previous posts because I think they may be
> >> confusing to you.
>
> >> Typically Functions are added at the end of the script. I doubt this is a
> >> requirement but it really doesn't matter, I will continue to put them at
> >> the
> >> end of the script and for the sake of this conversation, put them at the
> >> end. So to answer your question, What goes after End Function...nothing.
>
> >> Does your Function sGetSomeData do anything? If it does, then place it in
> >> the Function sGetSomeData in the script I will paste. If your Function
> >> sGetSomeData does not do anyting, then you need to pick some data you
> >> want
> >> to Get Some of.
>
> >> Edits this script will need are:
> >> SMNP_SERVER - this will be the name or IP of your SNMP server.
> >> TO_ADDRESS - to whom you want to send this email.
> >> FROM_ADDRESS - from whom you want the email to appear
>
> >> If you Copy/Paste this script and fill in the three(3) uppercase fields
> >> immediately above, you will receive a blank email.
>
> >> If you take your Function sGetSomeData and paste it into this script, in
> >> place of what I have, the email will contain the data you retrieved.
>
> >> It is recommended that you be able to read through vbScript before you
> >> try
> >> to productionalize one.
>
> >> Last call.
> >> Bart
>
> >> Here is the script. I have split some of the lines up to discourage a
> >> wordwrap issue.
>
> >> ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> Dim objEmail, strEmailSubject, strEmailBody, someData
>
> >> Const SEND_USING = "2"
> >> Const SMTP_SERVER = "" ' enter your SMTP server
> >> Const SMTP_PORT = "25"
> >> Const FROM_ADDRESS = "" ' enter your From Address
> >> Const TO_ADDRESS = "" ' enter your To Address
>
> >> strEmailSubject = "Your Subject"
>
> >> strEmailBody = sGetSomeData()
>
> >> Set objEmail = CreateObject("CDO.Message")
>
> >> objEmail.From = FROM_ADDRESS
> >> objEmail.To = TO_ADDRESS
> >> objEmail.Subject = strEmailSubject
> >> objEmail.TextBody = strEmailBody
>
> >> objEmail.Configuration.Fields.Item _
> >> ("http://schemas.microsoft.com/cdo/configuration/sendusing") _
> >> = SEND_USING
>
> >> objEmail.Configuration.Fields.Item _
> >> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
> >> = SMTP_SERVER
>
> >> objEmail.Configuration.Fields.Item _
> >> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
> >> = SMTP_PORT
>
> >> objEmail.Configuration.Fields.Update
>
> >> objEmail.Send
>
> >> ' you need to put the content of your
> >> ' sGetSomeData into this Function
> >> Function sGetSomeData()
> >> sGetSomeData = someData
> >> End Function
> >> ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > --------------
> >> Does your Function sGetSomeData do anything?
> > The script extract some data(ASCII) from file and write this data to
> > hard disk or show it as MsgBox. The results is sGetSomeData =
> > SomeData.
>
> > mistral
--
> Then you should be able to take the contents of your sGetSomeData and paste
> it into this script. Assuming you are not writing to disk in sGetSomeData.

> Paste your script including your email settings.
------------

So at first code tries send email then the main function retrieves the
necessary data?