WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: BVVNAIDU937 on April 27, 2017, 08:23:17 PM

Title: How to send email to Multiple Recipients through INI or CFG or TXT file
Post by: BVVNAIDU937 on April 27, 2017, 08:23:17 PM
Dear Winbatch Tech team,

I have one small project in my process to send the emails to multiple team members and i implmaneted one code of the same by using winbatch database sample codes,but my request ,it is possible to  send it by using any INI or CFG or TXT or CFG files.Please find the below my code.

Kindly help me on this request.

recip1="V.Bandi@Gmail.com"

recip2="Dhananjaya.Kasaragod@Gmail.com"

objOutlook = ObjectOpen("Outlook.Application")

; Create the message.
objOutlookMsg = objOutlook.CreateItem(0)

; Display to user (the following line can be removed if you do not want any interface)
objOutlookMsg.Display

; add Recipient
objOutlookRecip=objOutlookMsg.Recipients
objOutlookRecip.Add(Recip1)  ;<<<<<<<
;objOutlookRecip.Add(Recip2) ;<<<<<<<

; Set the Subject, Body,
objOutlookMsg.Subject = "Server Space Report"
objOutlookMsg.Body = strcat("Hi All,Please find the attached Server Disk Space Utilization Report.",@CRLF)

; Add attachments to the message.
Attachmentpath='C:\LOGS\ServerSpace.xls' 
objOutlookAttach = objOutlookMsg.Attachments
objOutlookAttach.Add(AttachmentPath)
objOutlookMsg.Send
ObjectClose(objOutlook)
exit

Title: Re: How to send email to Multiple Recipients through INI or CFG or TXT file
Post by: td on April 28, 2017, 06:43:29 AM
Check out the IniReadPvt and IniWritePvt functions in the Consolidated WIL Help file.  The help file's IniReadPvt example:

Code (winbatch) Select
;IMPORTANT Path information must be specified if the
;INI file is not in the Windows directory.
a=IniReadPvt("Main", "Lang", "English", "WB.INI")
Message("IniReadPvt",a)


Given the following segment from WB.INI:
[Main]
Lang=French

The statement above would Return:
French
Title: Re: How to send email to Multiple Recipients through INI or CFG or TXT file
Post by: BVVNAIDU937 on May 02, 2017, 10:27:57 AM
Thanks Team for your Help,

Now am able to send multiple reciitents from private INI file
Title: Re: How to send email to Multiple Recipients through INI or CFG or TXT file
Post by: td on May 02, 2017, 10:58:35 AM
Cool.