Solved

script

Posted on 2016-10-26
2
41 Views
Last Modified: 2016-11-14
Hello.. Script to read a text file and send email alert of particular content of that text file.

Example: Attached a .txt (carsim.txt) file which contains license expiry date "05-apr-2017"
Need script to read that particular line (line number 12 & 13) and send email through outlook.

Kindly help.
Carsim.txt
0
Comment
Question by:Karthick Rajendran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 24

Accepted Solution

by:
NVIT earned 500 total points (awarded by participants)
ID: 41861433
Make doit.bat

find /i "carsim"<Carsim.txt>"c:\folder\output.txt"
cscript /nologo SendEmail.vbs

Open in new window


Make SendEmail.vbs.
Adjust Subject, From, To, TextBody, AddAttachment values to your needs.

Set MyEmail=CreateObject("CDO.Message")

MyEmail.Subject="Carsim license expiry date "
MyEmail.From="admin@domain.com"
MyEmail.To="admin@domain.com"
MyEmail.TextBody="See attachment"
MyEmail.AddAttachment "c:\folder\output.txt"

MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'SMTP Server
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtpserver.domain.com"

'SMTP Port
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 

'SMTP Auth (For Windows Auth set this to 2)
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1

' If your server requires authentication, enable the Username and Password lines below:
'Username
'MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")="admin@domain.com" 
'Password
'MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")="password"

MyEmail.Configuration.Fields.Update
MyEmail.Send

set MyEmail=nothing

Open in new window


Run doit.bat
1
 
LVL 24

Expert Comment

by:NVIT
ID: 41886048
Question answered.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question