/** * メール送信 */ protected function send() { $Mail = new MW_WP_Form_Mail(); $form_key = $this->ExecShortcode->get('key'); $attachments = $this->get_attachments(); $Mail_Service = new MW_WP_Form_Mail_Service($Mail, $form_key, $this->Setting, $attachments); // 管理画面で作成した場合だけ自動で送信 if ($this->ExecShortcode->is_generated_by_formkey()) { $Mail_Service->send_admin_mail(); // 自動返信メールの送信 $automatic_reply_email = $this->Setting->get('automatic_reply_email'); if ($automatic_reply_email) { $automatic_reply_email = $this->Data->get_post_value_by_key($automatic_reply_email); $is_invalid_mail_address = $this->validation_rules['mail']->rule($automatic_reply_email); if ($automatic_reply_email && !$is_invalid_mail_address) { $Mail_Service->send_reply_mail(); } } // 問い合わせ番号を加算 $Mail_Service->update_tracking_number(); } }
/** * @group tracking_number * @backupStaticAttributes enabled */ public function test_tracking_number() { $this->Setting->set('admin_mail_content', '{' . MWF_Config::TRACKINGNUMBER . '}'); $Mail_Service = new MW_WP_Form_Mail_Service($this->Mail, $this->form_key, $this->Setting); $this->assertEquals(1, $this->Setting->get_tracking_number()); $Mail_Service->update_tracking_number(); $this->assertEquals(2, $this->Setting->get_tracking_number()); }