How to define multi email address
Copy link to clipboard
Copied
Hi experts,
a script like this:
var notify = true; // set to true if you want a popup measage to say that the mail is sending
var delay = 1.5 // the number of seconds you want the popup to appear
var ToAddress = "xxxxxxxxxxxx@gmail.com"; // You might need to change this
var MessageSubject = "Chinese Version of translation"; // You might need to change this
// bodyText set at line 27 Below
var myAttachments = File.openDialog ("Select the files you wish to attach", "All Files: *.*", true);
if (!myAttachments) {
alert("Sorry mate I can't send your attachments if you don't select them\rPlease try again next year\rThanks");
exit();
}
var n, MessageAttachments = [], bodyFileNames = [], fName = "";
for (n = 0; n < myAttachments.length; n++) {
fName = myAttachments
.fsName; MessageAttachments
= 'newMail.Attachments.Add("' + fName + '")'; bodyFileNames
= fName; }
MessageAttachments = MessageAttachments.join("\r") + "\r";
bodyFileNames = bodyFileNames.join("\" & vbNewLine & \"");
// the \" & vbNewLine & \" is a way off putting in line feads
MessageBody = "Howdy i spent yonks of time making this. \" & vbNewLine & \"" + bodyFileNames; // You might need to change this
//VBS code very very very heavily based on the answer of ShaddowFox333 http://www.tek-tips.com/viewthread.cfm?qid=728333
myVBS = '''Dim ToAddress
Dim FromAddress
Dim MessageSubject
Dim MessageBody
Dim MessageAttachment
Dim ol, ns, newMail
ToAddress = "''' + ToAddress + '''"
MessageSubject = "''' + MessageSubject + '''"
MessageBody = "''' + MessageBody + '''"
Set ol = CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf
newMail.RecipIents.Add(ToAddress)
''' +
MessageAttachments + "newMail.Send";
try {
app.doScript (myVBS, ScriptLanguage.VISUAL_BASIC, undefined, UndoModes.AUTO_UNDO);
if (notify) {
var tempFile = new File (Folder.temp + "/" + +new Date + ".vbs");
tempFile.open('w');
tempFile.write('''Set shell = CreateObject("Wscript.Shell")
delay = ''' + delay + '''
shell.Popup "Sending document by outlook", delay, "InDesign Mail Manager", 64
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile("''' + tempFile.fsName + '''"),DeleteReadOnly
''');
tempFile.close();
tempFile.execute();
}
}
catch (e) {alert ("Drat goofed up")}
for send email.
but it only has one email address to send, how can I make it can send to multi email address?
I mean how can I change this like:
var ToAddress = "xxxxxxxxxxxx@gmail.com"; // You might need to change this
thanks
regard
John
Copy link to clipboard
Copied
John,
You could try this format.
var ToAddress = "first@example.com;second@example.com;third@example.com",
Regards,
Mike

