用于从Excel中的列表发送电子邮件的AppleScript
我一点也不知道AppleScript,所以提前感谢您在这个问题上提供的任何帮助。 我在Macbook Pro笔记本电脑上安装了最新版本的OSX。我有一个Excel电子表格(如果方便的话,我可以使用数字),有两列用于从Excel中的列表发送电子邮件的AppleScript,excel,macos,applescript,Excel,Macos,Applescript,我一点也不知道AppleScript,所以提前感谢您在这个问题上提供的任何帮助。 我在Macbook Pro笔记本电脑上安装了最新版本的OSX。我有一个Excel电子表格(如果方便的话,我可以使用数字),有两列 FirstName Email ------------ ----------------- Ken blah@blah.com Mike blahblah@blahblah.com 这是我的客户名单,我想给他们发
FirstName Email
------------ -----------------
Ken blah@blah.com
Mike blahblah@blahblah.com
这是我的客户名单,我想给他们发封电子邮件。不幸的是,我没有这个列表在自动回复,所以我必须发送电子邮件一个接一个
我知道我可以编写一个PHP脚本来发送电子邮件,但是这样做的时候,电子邮件的可交付性会有问题
我想写一个AppleScript,一次处理一行电子表格并发送一条消息。
信息应该是这样的:
Subject: How’s it going?
Hi Ken
It’s been a while since I sold you that defective widget from China.
If you need more defective elctronics I’m here for you. Just give me
a call at xxx-xxx-xxxx.
Sincerely
Ken
AppleScript将从电子表格的一行中读取姓名和电子邮件地址,然后使用标准的apple mail程序发送此电子邮件,并填写姓名和电子邮件地址
发送消息后,我希望脚本等待60秒。然后再发一封电子邮件
在遇到空行之前,需要执行此操作
我的第一个问题……这可能吗?如果可能的话,我怎么做
还有没有更好的方法来做我想做的事情
谢谢可能有更好的方法来实现这一点,但您不能将地址复制为TSV或CSV吗
set addresses to "Ken;blah@blah.com
Mike;blahblah@blahblah.com"
set text item delimiters to ";"
repeat with l in paragraphs of addresses
tell application "Mail"
tell (make new outgoing message)
set subject to "subject"
set content to "Hi " & text item 1 of l & linefeed & linefeed & "..."
make new to recipient at end of to recipients with properties {name:text item 1 of l, address:text item 2 of l}
send
delay (random number) * 100
end tell
end tell
end repeat
尝试:
我可以把数据放在.csv格式。
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:"How’s it going?"}
tell mymail
make new to recipient at beginning of to recipients with properties {address:item i of eAddress}
set content to "Hi " & item i of firstName & "
It’s been a while since I sold you that defective widget from China.
If you need more defective elctronics I’m here for you. Just give me
a call at xxx-xxx-xxxx.
Sincerely
Ken"
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