随笔 - 833  文章 - 0  评论 - 9  阅读 - 35万

AppleScript发送邮件

实现效果

  1. 弹出对话框,输入收件人。
  2. 弹出对话框,输入收件人邮箱。
  3. 点击确认,发送邮件。

代码

-- 弹出对话框,输入收件人
set nameDialog to display dialog "请输入收件人:" default answer "luo" buttons {"确认"} default button 1

-- 保存收件人邮箱到recipientAddress
set recipientName to text returned of nameDialog

-- 弹出对话框,输入收件人邮箱地址
set addressDialog to display dialog "请输入收件人邮箱:" default answer "luoxiaolei@duck.com" buttons {"确认"} default button 1

-- 保存收件人邮箱到recipientAddress
set recipientAddress to text returned of addressDialog

-- 设置邮件标题
set theSubject to "AppleScript Automated Email"

-- 设置邮件内容
set theContent to "This email was created and sent using AppleScript!"

-- 调用outlook
tell application "Microsoft Outlook"
	-- 创建邮件
	set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent}
	
	-- 调用邮件
	tell theMessage
		set myemail to {name:recipientName, address:recipientAddress}
		-- 设置邮件收件人信息
		make new recipient with properties {email address:myemail}
		-- 发送邮件
		send
	end tell
end tell

参考链接

posted on   Simle  阅读(147)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2015-12-11 [Git]git常用命令总结
2015-12-11 [struts2]Struts遍历标签<s:iterator>总结 [转]
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示