我想要的是什么:
是否有任何工具或应用可以执行此操作? Outlook延迟交付,但我无法随机化。我正在考虑使用authotkey或php自己编码,但这需要我在后台运行程序,或者我需要设置服务器以在某些时间执行php文件。
非常感谢任何帮助。
答案 0 :(得分:0)
注意: 如果我没有被禁止提问,我会首先根据自己的情况创建自己的问题,然后自行回答我的个人实施问题。此后,我会将我的答案与OP联系起来,他需要根据自己的具体需求略微改变。
几个星期前我有一个类似的目标,并使用autohotkey和blat为它实现了一个解决方案。等式的第一步是你需要弄清楚如何正确地使用blat和stunnel。为此,建议您首先参考this link。
我特别要求的是,每天都会收到一封带有pdf附件的电子邮件。电子邮件正文包含文本文件中的特定文本。 pdf和txt文件都在一个单独的目录中,数量为数百个。通过这种方式,我会阅读一个不同的东西,并在一年的时间内每天收到不同的附件。
此后,我将其编译成一个exe并使用一个计划任务器,以便每天激活它。我不知道它是否可以随机完成,但我想你可以使用autohotkey编写自己的任务调度程序。
Beneath是我的代码,您需要根据您的特定需求进行更改。它激活stunnel,初始化blat然后发送你的电子邮件。如果没有找到互联网连接,它会在我的comp上打开pdf文件而不发送它。
global path = "C:\Your_Personal_Directory\Downloads\blat311\full"
SetWorkingDir %path%
global pdf_dir = "\tmp"
global daily_dir = "\temp"
global tirmidhi_dir = "\tirmidhi\txt"
global faqih_dir = "C:\Your_Personal_Directory\Downloads\Islamic-Books\Faqeehul-Ummat\split"
global thaanwi_dir = "C:\Your_Personal_Directory\Downloads\Islamic-Books\Thaanwi\split"
global pdf = "*.pdf"
global txt = "*.txt"
global docx = "*.docx"
global delim = "\"
global pdf_MaxCount = ComObjCreate("Shell.Application").NameSpace(path . pdf_dir).Items.Count
global tirmidhi_MaxCount = ComObjCreate("Shell.Application").NameSpace(path . tirmidhi_dir).Items.Count
global faqih_MaxCount = ComObjCreate("Shell.Application").NameSpace(faqih_dir).Items.Count
global thaanwi_MaxCount = ComObjCreate("Shell.Application").NameSpace(thaanwi_dir).Items.Count
global max_days = 365
global days := Retrieve_Days()
global custom_days := Retrieve_Days(true)
global ini_file = "daily_email.ini"
acrobat := "C:\Program Files\Adobe\Reader 11.0\Reader\AcroRD32.exe "
stunnel := "C:\Program Files\stunnel\stunnel.exe "
url=www.google.com
internet := true
RunWait, ping.exe %url% -n 1,, hide UseErrorlevel
If Errorlevel
{
MsgBox, No internet Connection, try again later.
internet := false
}
Run, %stunnel%,, hide UseErrorlevel
If Errorlevel
{
MsgBox, Something went wrong with stunnel.
internet := false
}
Retrieve_Days(custom_year = false) {
current_date := A_YYYY . A_MM . A_DD
if !custom_year
begin_date := A_YYYY . 01 . 01
else
begin_date := 2013 . 08 . 17
EnvSub, current_date, %begin_date%, days
If (current_date < 0)
{
MsgBox, Current Date yields negative.
Exit
}
return current_date + 1 ; Returns days passed since begin_date
}
Retrieve_File(l_path, sub_dir = "", file_extension_search = "*.*", number = 1) {
;Initialize
FileList =
search = %l_path%%sub_dir%\%file_extension_search%
Loop, %search%
FileList = %FileList%%A_LoopFileName%`n
Sort, FileList ; The R option sorts in reverse order. See Sort for other options.
Loop, parse, FileList, `n
{
if A_LoopField = ; Ignore the blank item at the end of the list.
continue
test = %A_Index%
if (test = number)
return l_path . sub_dir . delim . A_LoopField
}
}
daily := retrieve_file(path, daily_dir, txt, Mod(days, max_days))
pdf_attachment := retrieve_file(path, pdf_dir, pdf, Mod(custom_days, pdf_MaxCount))
tirmidhi := retrieve_file(path, tirmidhi_dir, txt, Mod(custom_days, tirmidhi_MaxCount))
faqih_attachment := retrieve_file(faqih_dir,, pdf, Mod(custom_days, faqih_MaxCount))
thaanwi_attachment := retrieve_file(thaanwi_dir,, pdf, Mod(custom_days, thaanwi_MaxCount))
If internet
{
runwait blat -install 127.0.0.1 "Your Name <your_email_address@gmail.com>"- - -u your_email_address@gmail.com -pwd Your_Pasword,, hide
runwait blat %daily% -to your_email_address@gmail.com -subject "Daily Quran Reading" -attach %pdf_attachment%,, hide
runwait blat %tirmidhi% -to your_email_address@gmail.com -subject "Daily Tirmidhi Reading",, hide
runwait blat %daily% -to your_email_address@gmail.com -subject "Daily Akaabir Reading: Faqihul-Ummat" -attach %faqih_attachment%,, hide UseErrorlevel
If Errorlevel
{
MsgBox, Something went wrong with faqih_attachment: %faqih_attachment%
exit
}
runwait blat %tirmidhi% -to your_email_address@gmail.com -subject "Daily Akaabir Reading: Thaanwi" -attach %thaanwi_attachment%,, hide UseErrorlevel
If Errorlevel
{
MsgBox, Something went wrong with thaanwi_attachment: %thaanwi_attachment%
exit
}
Run, %stunnel% -exit,, hide UseErrorlevel
If Errorlevel
{
MsgBox, Something went wrong with stunnel.
exit
}
}
else
{
run notepad %daily%
run notepad %tirmidhi%
run %acrobat% %pdf_attachment%
run %acrobat% %faqih_attachment%
run %acrobat% %thaanwi_attachment%
}
return