/** * メール送信 */ 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(); } }
/** * @backupStaticAttributes enabled */ public function test_データベースに保存() { $this->Setting->set('usedb', 1); $Mail_Service = new MW_WP_Form_Mail_Service($this->Mail, $this->form_key, $this->Setting); $Mail_Service->send_admin_mail(); $Mail_Service->send_reply_mail(); $this->assertEquals(1, count(get_posts(array('post_type' => MWF_Functions::get_contact_data_post_type_from_form_id($this->Setting->get('post_id')), 'posts_per_page' => -1)))); }