Solved Script to send out a email with an attachment

Microsoft Windows ultimate 64-bit 7
July 25, 2012 at 22:49:53
Specs: Windows 2003, 4
I have a 100 users and a 100 invoices, I have a text file in the following format

EmailAddress,Attachment
bob@dummy.com,invoice-102.pdf
Jane@acm.com,invoice-104.pdf

I am trying to work out if I can script some thing to send out a email using some thing like blat or another command line tool that could read in a file and then send each user a email and then also they correct invoice. As this would save me having to send 100 emails by hand.


See More: Script to send out a email with an attachment

Report •

#1
July 26, 2012 at 02:28:12
Do you HAVE a command line mailer?

If so, what's the syntax?


====================================
Life is too important to be taken seriously.

M2


Report •

#2
July 26, 2012 at 23:31:59
Lets go with blat as its nice and easy

Basic syntax would be
Hi M2 thank you for your reply,
lets go with blat as its easy

Blat.exe Messagebody.txt -to <EmailAddress> -attach <Attachment>


Messagebody.txt is a file that holds my message of "please see the attached invoice"

Then I would need to populate <EmailAddress> and <Attachment> with the values from the csv or text file


EmailAddress,Attachment
bob@dummy.com,invoice-102.pdf
Jane@acm.com,invoice-104.pdf


Report •

#3
July 27, 2012 at 01:17:11
✔ Best Answer
:: ===== script starts here ===============
::
:: james.bat 2012-07-27 15:03:56.45
@echo off > newfile & setLocal enableDELAYedeXpansioN

for /f "tokens=1-2 skip=1 delims=," %%a in (my.csv) do (
echo Blat.exe Messagebody.txt -to %%a -attach %%b
)
goto :eof

:sub1
for /f "tokens=* delims= " %%i in ('') do (

)
goto :eof
::====== script ends here =================


====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question