-
Notifications
You must be signed in to change notification settings - Fork 6
【データベース】メール通知で[[title]]を入れても、実際のメールにタイトルが表示されない #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
概要
対応案メールキューのモデルの変数 (詳細)メールキュー送信の流れデータベースの投稿通知を例に説明。 ・データベースで記事を登録時にメール送信処理が呼ばれる (※2 キュー実行) public function build()
{
return $this->text('mail.post.post_text')
->subject($this->bucket_mail->notice_subject)
->with([
'frame' => $this->frame,
'bucket' => $this->bucket,
'post' => $this->post,
'title' => $this->title,
'show_method' => $this->show_method,
'notice_method' => $this->notice_method,
'bucket_mail' => $this->bucket_mail,
]);
} ↓
↓ namespace App\Models\Common;
(省略)
class BucketsMail extends Model
{
(省略)
public function getFormatedNoticeBody($frame, $bucket, $post, $title, $show_method, $notice_method, $delete_comment = null)
{
$notice_body = $this->notice_body;
// [[method]]
$notice_body = str_ireplace('[[method]]', NoticeJobType::getDescription($notice_method), $notice_body);
// [[title]]
// $notice_body = str_ireplace('[[title]]', $post->title, $notice_body);
$notice_body = str_ireplace('[[title]]', $title, $notice_body);
// [[url]]
$url = url('/') . '/plugin/' . $bucket->plugin_name . '/' . $show_method . '/' . $frame->page_id . '/' . $frame->id . '/' . $post->id . '#frame-' . $frame->id;
$notice_body = str_ireplace('[[url]]', $url, $notice_body);
// [[delete_comment]]
$notice_body = str_ireplace('[[delete_comment]]', $delete_comment, $notice_body);
return $notice_body;
} 参考
php - Laravelキューシリアライズモデル特性が関連する値を削除 - スタックオーバーフロー
|
対応しました。 修正プログラム |
概要
・件名通りです。
実行環境
OS: windows10
ブラウザ: 新Edge
Connect-CMS: 2021/10/18 git pull
php version: 7.3.0
再現手順
件名通り
スクリーンショット
メール設定

原因
現時点では、DBテーブルのカラムでtitleがないと、件名表示できない作りになっていたため。
https://github.com/opensource-workshop/connect-cms/blob/master/app/Models/Common/BucketsMail.php#L27
対応案
$post->title, の箇所のカラム名を設定できるようにプログラム修正する。
The text was updated successfully, but these errors were encountered: