1

スケジュールされた時間にメールを送信する必要がある Web アプリに取り組んでいます。正しいシナリオは次のとおりです。メール送信機能が何らかの理由で失敗した場合、メール送信が成功するまでの特定の期間の後に再試行を行う必要があります。ここでの質問は、メーリングの詳細がどこかに記録されている場合 (mysql db テーブルはこちら)、再試行メカニズムがどのように実装されているかです。これは、cronjobs を使用せずに実装できますか? はいの場合、どのように??

前もって感謝します。

4

4 に答える 4

3

You'll need some kind of cron system anyway, but it could simply be a third party service calling a specific page on your site. Why don't you want to use cronjobs in the first place ?

Then your process would only be to log any failed attempt in a queue and treat the queue (= send mails) each x hours. You could also consider having a max number of retry or something like this.

于 2013-04-23T13:40:47.100 に答える
0

スケジュールされた時間を使用する必要がある場合は、間違いなく cronjob を使用します。電子メールが送信されていることを確認するには、送信されたかどうかを確認する true/false ループを使用します。

于 2013-04-23T13:44:27.330 に答える
0

無限ループを含む 1 つのページを作成してみてください。これは完全にテストされておらず、これまでにこのようなものを実装したことはありません-これは単なる提案です:

$hourToSend = 17; //this is the specified time to send (e.g. an hour, day, week..)

while(1)
{
    start:
    if(emailNotSent() == true && date('H') == $hourToSend) //boolean (function or variable) set after the email script has executed. could even be an array of email IDs.
    {
        resendEmail();
    }
    else
    {
        sleep(3600); //set an interval to check for failed emails, default = every hour
        goto start;
    }
}

これは、1 つのブラウザ ウィンドウを常に開いていても影響を受けない稼働時間の良いサーバーにアクセスできることを前提としています (監視、レポート、ログなどに役立つ可能性があります)。

+1 興味深い質問、コメント、提案を歓迎します

于 2013-04-23T13:56:27.183 に答える