通过 Applescript 发送电子邮件时发件人不正确 [英] Incorrect sender when sending Email via Applescript

查看:27
本文介绍了通过 Applescript 发送电子邮件时发件人不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的 Applescript 是我使用了多年的形式.并且基本上是使用 Applescript 发送电子邮件的众所周知的方法.

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 "mark@sender.com"
        make new to recipient at end of to recipients with properties {address:"recipient@mac.com"}
        send
    end tell
end tell

我今天刚刚注意到的是脚本中设置的发件人"电子邮件,可能不是 Mail.app如果未选择其帐户邮箱,则使用.如果选择了主收件箱,或者如果选择了单个邮箱,则将使用随机一个,然后将使用其帐户中的地址.

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.

我必须承认,在我去 Lion 之前,我不知道是否发生了这种情况.

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??.

谢谢.

推荐答案

这刚刚对我有用,希望对我有帮助:

this worked for me just now, hope it helps:

tell application "Mail"
  set theOutMessage to make new outgoing message with properties {visible:true}
  tell theOutMessage
    make new to recipient at end of to recipients with properties {address:"first@mail.com"}
    set sender to "Name Surname <name.surname@mail.com>"
    set subject to "Message Subject"
    set content to "Message Text"
  end tell
end tell

这篇关于通过 Applescript 发送电子邮件时发件人不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆