1

我想要的是:

  • 在随机时间和日期发送的电子邮件。
  • 电子邮件会选择我写在列表中的一条消息并将其发送。
  • 如果可能,在我设置完电子邮件后,无需我的交互即可发送电子邮件。
  • 再次发生。

是否有任何工具或应用程序可以做到这一点?Outlook 已延迟交付,但我无法将其随机化。我正在考虑使用 authotkey 或 php 自己编写代码,但这需要我在后台运行程序,或者我需要设置服务器以在某些时候执行 php 文件。

任何帮助将不胜感激。

4

1 回答 1

1

注意: 如果我没有被禁止提问,我会首先针对我的情况创建自己的问题,然后通过我的个人实施自己回答。此后,我会将我的答案与 OP 联系起来,他需要根据他的具体需要对其进行轻微修改。

几周前我有一个类似的目标,并使用 autohotkey 和 blat 实现了一个解决方案。等式的第一步是您需要弄清楚如何将 blat 与 stunnel 一起正确使用。为此,建议您先参考此链接

我特别要求的是,每天都会向我发送一封带有 pdf 附件的电子邮件。电子邮件正文将包含来自文本文件的特定文本。pdf 和 txt 文件都在一个单独的目录中,并且有数百个。这样,在一年的时间里,我每天都会阅读不同的内容并收到不同的附件。

此后,我将其编译为 exe,并使用计划任务程序每天激活它。我不知道它是否可以随机完成,但我想你可以使用 autohotkey 编写自己的任务调度程序。

下面是我的代码,您需要根据您的特定需求进行更改。它激活stunnel,初始化blat,然后发送您的电子邮件。如果没有找到互联网连接,它会在我的电脑上打开 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
于 2013-08-19T17:07:22.963 回答