![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Login Scripts email function I have different contractors that log in from time to time and I keep track of them with a login script the emails me me when they login. I have one for every contractor but would like to have just one script. Here is where i need help, In the subject and message I identify the contractor specifically, however I want to have a varaible that pulls the contractor's name from his login username, something like %USERNAME%, but I don't know how to do it with script. can any one help? ' Begin example SMTPServer = "192.168.xxx.xxx" Recipient = "yourcastle@xxxxxx" From = "Login@xxxxxx" Subject = "ESRI Has logged in" Message = "ESRI has logged in to Draco." ' To add an attachment update the full path and uncomment the line ' There is one line below that must also be uncommented 'attachment = "c: \ test.txt" ' Call Sub and pass required data GenericSendmail SMTPserver, From, Recipient, Subject, Message ' Begin Sub ' ------------------------------------------------------------------ ' Generic function to send mail using a remote ' SMTP server. Pass SMTPserver, From address, ' Recipient address, Subject, and Message as arguments ' ------------------------------------------------------------------ Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message) set msg = WScript.CreateObject("CDO.Message") msg.From = From msg.To = Recipient msg.Subject = Subject msg.TextBody = Message msg.Configuration.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 msg.Configuration.Fields.Update msg.Send End Sub Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Login Scripts email function "Desolator" <Desolator@xxxxxx> wrote in message news:584C15F4-779A-4197-A196-6CDDCCE17545@xxxxxx Quote: >I have different contractors that log in from time to time and I keep track > of them with a login script the emails me me when they login. I have one > for > every contractor but would like to have just one script. Here is where i > need help, > > In the subject and message I identify the contractor specifically, however > I > want to have a varaible that pulls the contractor's name from his login > username, something like %USERNAME%, but I don't know how to do it with > script. can any one help? > > ' Begin example > SMTPServer = "192.168.xxx.xxx" > Recipient = "yourcastle@xxxxxx" > From = "Login@xxxxxx" > Subject = "ESRI Has logged in" > Message = "ESRI has logged in to Draco." > > ' To add an attachment update the full path and uncomment the line > ' There is one line below that must also be uncommented > > > 'attachment = "c: \ test.txt" > > > ' Call Sub and pass required data > GenericSendmail SMTPserver, From, Recipient, Subject, Message > > ' Begin Sub > ' ------------------------------------------------------------------ > ' Generic function to send mail using a remote > ' SMTP server. Pass SMTPserver, From address, > ' Recipient address, Subject, and Message as arguments > ' ------------------------------------------------------------------ > Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message) > > set msg = WScript.CreateObject("CDO.Message") > msg.From = From > msg.To = Recipient > msg.Subject = Subject > msg.TextBody = Message > > > msg.Configuration.Fields > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer > msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") > = 2 > > msg.Configuration.Fields.Update > > msg.Send > > End Sub "environmental" (because %Username% is an env. variable!). |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Login Scripts email function "Pegasus [MVP]" <news@xxxxxx> wrote in message news:e9Rbu20pJHA.4564@xxxxxx Quote: > > "Desolator" <Desolator@xxxxxx> wrote in message > news:584C15F4-779A-4197-A196-6CDDCCE17545@xxxxxx Quote: >>I have different contractors that log in from time to time and I keep >>track >> of them with a login script the emails me me when they login. I have one >> for >> every contractor but would like to have just one script. Here is where i >> need help, >> >> In the subject and message I identify the contractor specifically, >> however I >> want to have a varaible that pulls the contractor's name from his login >> username, something like %USERNAME%, but I don't know how to do it with >> script. can any one help? >> >> ' Begin example >> SMTPServer = "192.168.xxx.xxx" >> Recipient = "yourcastle@xxxxxx" >> From = "Login@xxxxxx" >> Subject = "ESRI Has logged in" >> Message = "ESRI has logged in to Draco." >> >> ' To add an attachment update the full path and uncomment the line >> ' There is one line below that must also be uncommented >> >> >> 'attachment = "c: \ test.txt" >> >> >> ' Call Sub and pass required data >> GenericSendmail SMTPserver, From, Recipient, Subject, Message >> >> ' Begin Sub >> ' ------------------------------------------------------------------ >> ' Generic function to send mail using a remote >> ' SMTP server. Pass SMTPserver, From address, >> ' Recipient address, Subject, and Message as arguments >> ' ------------------------------------------------------------------ >> Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message) >> >> set msg = WScript.CreateObject("CDO.Message") >> msg.From = From >> msg.To = Recipient >> msg.Subject = Subject >> msg.TextBody = Message >> >> >> msg.Configuration.Fields >> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = >> SMTPServer >> msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") >> = 2 >> >> msg.Configuration.Fields.Update >> >> msg.Send >> >> End Sub > Download script56.chm from the Microsoft site, then search it for the > string "environmental" (because %Username% is an env. variable!). http://msdn.microsoft.com/en-us/libr...3f(VS.85).aspx /Al |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Login Scripts email function Try this in a vbs file during logon, works for us: Set WshNetwork = WScript.CreateObject("WScript.Network") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objEmail = CreateObject("CDO.Message") objEmail.From = " & WshNetwork.username & "@domain.com" objEmail.To = "username@xxxxxx" objEmail.Subject = "User " & WshNetwork.UserName &" Logged on" objEmail.Textbody = "" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "servername" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send "Desolator" <Desolator@xxxxxx> wrote in message news:584C15F4-779A-4197-A196-6CDDCCE17545@xxxxxx Quote: >I have different contractors that log in from time to time and I keep track > of them with a login script the emails me me when they login. I have one > for > every contractor but would like to have just one script. Here is where i > need help, > > In the subject and message I identify the contractor specifically, however > I > want to have a varaible that pulls the contractor's name from his login > username, something like %USERNAME%, but I don't know how to do it with > script. can any one help? > > ' Begin example > SMTPServer = "192.168.xxx.xxx" > Recipient = "yourcastle@xxxxxx" > From = "Login@xxxxxx" > Subject = "ESRI Has logged in" > Message = "ESRI has logged in to Draco." > > ' To add an attachment update the full path and uncomment the line > ' There is one line below that must also be uncommented > > > 'attachment = "c: \ test.txt" > > > ' Call Sub and pass required data > GenericSendmail SMTPserver, From, Recipient, Subject, Message > > ' Begin Sub > ' ------------------------------------------------------------------ > ' Generic function to send mail using a remote > ' SMTP server. Pass SMTPserver, From address, > ' Recipient address, Subject, and Message as arguments > ' ------------------------------------------------------------------ > Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message) > > set msg = WScript.CreateObject("CDO.Message") > msg.From = From > msg.To = Recipient > msg.Subject = Subject > msg.TextBody = Message > > > msg.Configuration.Fields > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer > msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") > = 2 > > msg.Configuration.Fields.Update > > msg.Send > > End Sub > > > > Thanks |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| most effective way via javascript login scripts to allow login rightsto all our servers to our Network Team group | VB Script | |||
| Login scripts vs UAC | Vista General | |||
| Login Scripts | Vista networking & sharing | |||
| Login Scripts Not Running | Vista networking & sharing | |||
| More Login Scripts | Vista General | |||