email - VB script for send mail adding multiple variable recipients -


i relatively new writing vb scripts. essentially, need functioning vb script send email multiple recipients vary each email. need have subject line, email body, attachment , flexibility add multiple recipients in to, cc , bcc fields without adding individual lines of add.recipient each email address in field. have suggestions or know of resources find information?

i have looked myself , coming blank on it.  i have arguments set in seperate.txt file. these vary constantly. trying efficiently possible.

i have not had luck add.cc command took out example...below have written out,

set args = wscript.arguments arg1 = args.item(0)   arg2 = args.item(1) arg3 = args.item(2) toaddress = ""&arg1&"" ccaddress = ""&arg2&"" messagesubject = "your order" messagebody = "please find order attached"  messageattachment = ""&arg3&""   set ol = wscript.createobject("outlook.application") set ns = ol.getnamespace("mapi") set newmail = ol.createitem(olmailitem) newmail.subject = messagesubject newmail.body = messagebody & vbcrlf & mytime newmail.recipients.add(toaddress) newmail.attachments.add(messageattachment) newmail.send 

i have arguments written out as:

cscript //nologo test1.vbs email1@email.com email2@email.com y:\folder\test.txt  

'get email addresses, -2 ignores attachment x = 0 wscript.arguments.count - 2      msgbox wscript.arguments(x) & "count " & x next msgbox wscript.arguments(wscript.arguments.count - 1) & " attachment" 

in programming use procedural steps, do. need loops. because wanted last , last used for x = loop. for each loops better , cleaner code.

this prints out arguments

for each ag in wscript.arguments      msgbox ag  next 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -