Ich würde mich sehr freuen, wenn mir jemand beim Erstellen eines Applescripts zum Versenden einiger E-Mails helfen könnte. Ich habe einige Beispiele gesehen, bin mir aber nicht sicher, ob ich sie an meine eigenen Bedürfnisse anpassen kann.
Ich muss dieselbe E-Mail (Betreff und Text) einzeln an eine Liste von Adressen in einer CSV-Datei senden. Ich verwende Apple Mail 5.3 und OSX 10.7.5
Vielen Dank im Voraus an alle, die bereit sind zu helfen.
Hier ist, was ich bisher habe.
tell application "Mail"
tell (make new outgoing message)
set theAddress to "xxxx"
make new to recipient at beginning of to recipients with properties {address:theAddress}
set subject to "xxxx"
set content to "xxxx"
send
end tell
end tell
Ich muss die Adresse auf Zelle A1 in meinem Excel-Blatt setzen. Wie zeige ich es dort? Sobald die E-Mail gesendet wurde, muss ich sie auf Zelle A2 verweisen ... und so weiter.
Der einfachste und schnellste Weg, dies in anderen Sprachen zu tun, wäre, jede Ihrer Spalten aus Excel in eine Liste (Array) zu ziehen und dann das Ganze in einer Schleife zu haben, und es wird die E-Mail erstellen, die Informationen ausfüllen und dann senden E-Mail kehrt dann zum Anfang zurück und beginnt erneut mit Werten aus jedem der Arrays bei [1] und so weiter von dort durch Ihre Liste. Nicht der professionellste oder effizienteste Weg, aber für Ihre Zwecke würde das funktionieren. Wenn du das umsetzen kannst, dann mach weiter. Wenn nicht, werde ich es skripten, wenn ich zu meinem Desktop zurückkomme.
----bearbeiten----
Ich habe das Skript bearbeitet, das zuerst in diesem Beitrag geschrieben wurde: https://stackoverflow.com/questions/15386794/applescript-for-sending-emails-from-a-list-in-excel
um dieses Skript zu erreichen. Ich programmiere meistens in Java, also ist das vielleicht nicht perfekt, also kann vielleicht jemand vorbeikommen und es optimieren. OP sollte durchgehen und seine eigenen Werte für die in Großbuchstaben geschriebenen Dinge eingeben. Außerdem muss das Excel-Blatt in der Form vorliegen, in der sich das OP aus dem Links-Excel-Blatt befindet
set {firstName, eAddress} to getData()
repeat with i from 1 to count firstName
tell application "Mail"
activate
set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"INSERT SUBJECT HERE"}
tell mymail
make new to recipient at beginning of to recipients with properties {address:item i of eAddress}
--The next line will start each email with Hi firstName and then carriage return to the text you fill in below
set content to "Hi " & item i of firstName & "
INSERT BODY OF EMAIL HERE"
end tell
--show message window (otherwise it's hidden)
set visible of mymail to true
--bring Mail to front
activate
send mymail
end tell
end repeat
on getData()
set colA to {}
set colB to {}
tell application "Microsoft Excel"
activate
tell active sheet
set lastRow to first row index of (get end (last cell of column 1) direction toward the top)
repeat with i from 3 to lastRow
set end of colA to (value of range ("A" & i))
set end of colB to (value of range ("B" & i))
end repeat
end tell
end tell
return {colA, colB}
end getData
Grundsätzlich müssen Sie mit dem Lesen der XLS-Datei mit AppleScript beginnen (und dann tell "Mail"
für jede gefundene Adresse). Als Starter können Sie sich beraten lassen
und arbeite dich von dort aus nach oben.
Ich verwende dies, um Call for Papers zu senden. Es sendet Stapel von 90 E-Mails in BCC aus einer Liste von 1000 E-Mails. Es ist ein AppleScript.
set title to "Call for papers conference XXX"
set body to read "/Users/ber/Desktop/bod_of_email.txt" as «class utf8»
set addresses to read "/Users/ber/Desktop/mail/email_list_one_email_per_row.txt" as «class utf8»
set bccRecipients to {}
set c to 0
repeat with e in paragraphs of addresses
if length of e is greater than 10 then
copy e to the end of the bccRecipients
set c to c + 1
if c = 90 then
tell application "Mail"
activate
tell (make new outgoing message)
set visible to true
make new recipient at end of to recipients with properties {address:"conference@chair.com"}
repeat with thisRecipient in bccRecipients as list
make new bcc recipient at end of bcc recipients with properties {address:thisRecipient}
end repeat
set subject to title
set content to body
send
delay 3
end tell
end tell
set bccRecipients to {}
set c to 0
end if
end if
end repeat
Jan C.
0942v8653
Wille
Big Mac