Solved

script

Posted on 2016-10-26
2
38 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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