Me encantaría que alguien pudiera ayudarme a crear un Applescript para enviar algunos correos electrónicos. He visto algunos ejemplos, pero no estoy seguro de poder adaptarlos a mis propias necesidades.
Necesito enviar el mismo correo electrónico (asunto y cuerpo), uno a la vez, a una lista de direcciones en un archivo .csv. Estoy usando Apple Mail 5.3 y OSX 10.7.5
Muchas gracias de antemano a quien quiera ayudar.
Esto es lo que tengo hasta ahora.
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
Necesito configurar la dirección en la celda A1 en mi hoja de Excel. ¿Cómo lo apunto allí? Una vez que se ha enviado el correo electrónico, necesito apuntarlo a la celda A2... y así sucesivamente.
La forma más simple y rápida de hacer esto en otros idiomas sería colocar cada una de sus columnas de Excel en una lista (matriz) y luego tener todo en un bucle y creará el correo electrónico, complete la información y luego envíe el correo electrónico, luego regrese al principio y comience de nuevo con los valores de cada una de las matrices en [1] y así sucesivamente desde allí a través de su lista. No es la forma más profesional o eficiente, pero para sus propósitos eso funcionaría. Si puedes implementar eso, adelante. Si no, lo escribiré cuando regrese a mi escritorio.
----editar----
Edité el script escrito por primera vez en esta publicación: https://stackoverflow.com/questions/15386794/applescript-for-sending-emails-from-a-list-in-excel
para lograr este guión. Principalmente codifico en Java, por lo que esto podría no ser perfecto, así que tal vez alguien pueda venir y modificarlo. OP debe pasar e ingresar sus propios valores para las cosas escritas en mayúsculas. Además, la hoja de Excel debe estar en la forma en que se encuentra el OP de la hoja de Excel de enlaces
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
Básicamente, debe comenzar leyendo el archivo XLS con AppleScript (y luego tell "Mail"
para cada dirección que encuentre). Como entrada puedes consultar
y sigue tu camino desde allí.
Utilizo esto para enviar la convocatoria de documentos. Envía lotes de 90 correos electrónicos en BCC de una lista de 1000 correos electrónicos. Es un 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
ian c
0942v8653
Voluntad
Big_Mac