VB 脚本代码:从 Excel 读取邮箱信息并使用 Foxmail 发送邮件
从 Excel 读取邮箱地址, 邮箱标题, 邮箱内容后, 可以使用 SendKeys 语句模拟在 Foxmail 软件中进行发信操作。
例如:
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim strMailTo As String, strSubject As String, strContent As String
Dim i As Integer
Set xlApp = New Excel.Application
Set xlWB = xlApp.Workbooks.Open("C:\email.xlsx")
Set xlSheet = xlWB.Worksheets(1)
For i = 2 To xlSheet.UsedRange.Rows.Count
strMailTo = xlSheet.Cells(i, 1).Value
strSubject = xlSheet.Cells(i, 2).Value
strContent = xlSheet.Cells(i, 3).Value
AppActivate "Foxmail"
SendKeys strMailTo & "{TAB}" & strSubject & "{TAB}" & strContent & "{ENTER}"
Next
xlWB.Close
xlApp.Quit
Set xlApp = Nothing
Set xlWB = Nothing
Set xlSheet = Nothing
注意:
- 该代码仅供参考,实际使用中可能需要根据具体情况进行修改。
- 使用 SendKeys 语句模拟操作可能会受到 Foxmail 版本和系统环境的影响。
- 建议使用更可靠的邮件发送 API 或库来实现自动化发信功能。
原文地址: https://www.cveoy.top/t/topic/loHM 著作权归作者所有。请勿转载和采集!