通过 Applescript 发送电子邮件时发件人不正确
下面的 Applescript 是我多年来使用的形式。基本上是一种众所周知的使用 Applescript 发送电子邮件的方法。
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:"IP Address", content:"Your IP Address Is: 86.195.132.134"}
tell newMessage
set visible to false
set sender to "[email protected]"
make new to recipient at end of to recipients with properties {address:"[email protected]"}
send
end tell
end tell
我今天刚刚注意到的是脚本中设置的“发件人”电子邮件,可能不是 Mail.app 如果未选择其帐户邮箱,则使用。如果选择主收件箱或选择单个邮箱,则将使用随机邮箱,然后将使用其帐户中的地址。
我认为这是因为在“邮件”首选项中的“撰写”下。有一个设置“从以下位置发送新消息:”
您无法选择'不'。唯一的选项是“所选邮箱的帐户”或组合框下拉列表中的电子邮件地址之一。
我必须承认,在我去 Lion 之前,我不知道这种情况是否发生过。
有谁知道这个问题的修复方法,或者这是一个已知的错误吗?
谢谢。
The Applescript below is in the form that I have used for a number of years. And is basically a well known method of sending emails using Applescript.
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:"IP Address", content:"Your IP Address Is: 86.195.132.134"}
tell newMessage
set visible to false
set sender to "[email protected]"
make new to recipient at end of to recipients with properties {address:"[email protected]"}
send
end tell
end tell
What I just noticed today is the 'sender' email set in the script, may not be the one Mail.app
uses if its account mail box is not selected. A random one will be used if the main inbox is selected or if an individual mailbox is selected then an address from it's account will be used.
I think this is because in the Mail preferences, under Composing. There is a setting to 'Send new messages from:'
You cannot select 'NO'. The only options are 'Account of selected mailbox' or one of the email addresses that are in the combo box drop down.
I must admit I do not know if this was been happening before I went to Lion.
Does anyone know of a fix for this, or if this is a known bug??.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这刚刚对我有用,希望有帮助:
this worked for me just now, hope it helps:
我不知道我从哪里得到这个,但发件人需要特定的格式。它应该是:
您查看邮件的帐户首选项,并使用其中一个帐户的“全名”和“电子邮件地址”字段......但将其放入我显示的表格中。我刚刚检查过,这种格式适合我。因此我在我的苹果脚本中使用它......
I don't know where I got this from, but the sender needs a particular format. It should be:
You look in Mail's account preferences, and use the "Full Name" and "email address" fields from one of the accounts... but put it in the form I showed. I just checked and this format works for me. As such I use this in my applescripts...
要了解您有哪些可用电子邮件,这可以帮助您:
To figure out what emails you have available this can help:
如果您正在寻找一个可以发送电子邮件的脚本,那么这个应该可以。
If you are looking for a script that will send an email, this one should work.