MailResender
in package
投稿データに保存したメールを再送する。
送信時に保存した件名・本文・宛先(envelope)をそのまま送り、テンプレートからは作り直さない。 差出人(From)だけは、再送時点のフォーム設定に値があればそれで送る。 並行した再送で二重に送らないよう、送信前に送信状態を sending へ確保してから送る。
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- canResend() : bool
- 投稿データのメールを再送できるか
- resend() : ResendOutcome
- メールを1通再送する
- resendFrom() : string
- 再送に使う差出人(From)を返す
- send() : void
Properties
$repository
private
RepositoryInterface
$repository
Methods
__construct()
public
__construct(RepositoryInterface $repository) : mixed
Parameters
- $repository : RepositoryInterface
canResend()
投稿データのメールを再送できるか
public
canResend(array{status: string, envelope: array{to: list}|null} $logMail, bool $allowSent) : bool
送信に失敗したメール($allowSent のときは送信済み・送信待ちのメールも)で、再送に使う宛先を保存しているものに限る。
Parameters
-
$logMail
: array{status: string, envelope: array{to: list
}|null} -
RepositoryInterface::findLog のメール
- $allowSent : bool
-
送信済みのメールも再送するか
Return values
boolresend()
メールを1通再送する
public
resend(int $formId, int $serial, int $blogId, LogMailTarget $target, bool $allowSent[, callable(ResendMail): Array|null $beforeSend = null ][, callable(ResendMail, MailStatus, Array): void|null $afterSend = null ]) : ResendOutcome
Parameters
- $formId : int
- $serial : int
-
通番
- $blogId : int
-
参照元のブログID
- $target : LogMailTarget
-
再送するメール
- $allowSent : bool
-
送信済み・送信待ちのメールも再送するか
- $beforeSend : callable(ResendMail): Array|null = null
-
送信直前に呼ぶ。差し替えたメールを返し、null を返すと再送を取りやめる
- $afterSend : callable(ResendMail, MailStatus, Array): void|null = null
-
送信後に、結果の送信状態と失敗時の例外を受け取る
Return values
ResendOutcomeresendFrom()
再送に使う差出人(From)を返す
public
resendFrom(int $formId, LogMailTarget $target, string $savedFrom) : string
再送時点のフォーム設定(管理者宛は AdminFrom、自動返信は From)に値があればそれを、 設定が空の場合とフォームが削除されている場合は送信時に保存した差出人を返す。
Parameters
- $formId : int
- $target : LogMailTarget
- $savedFrom : string
-
送信時に保存した差出人
Return values
stringsend()
private
send(ResendMail $mail) : void
Parameters
- $mail : ResendMail