title = __("mail", "dagsopt"); $this->pluginname = $ns->pluginname; $this->file = $ns->file; $this->ns = $ns; } function start() { $this->logfile = fopen(ABSPATH . "/wp-content/uploads/maillog.log", 'a'); add_filter('wp_mail', array(&$this, 'mail_logger'), 10, 1); add_filter('wp_mail_from_name', array(&$this, 'sender_name')); add_filter('wp_mail_from', array(&$this, 'sender_email')); //add_filter("wp_footer", array(&$this, 'tester')); } function sender_email($original_email_address) { $g = stripcslashes(get_option($this->pluginname . "_mail_emailsettings")); $arr = json_decode($g, true); if (isset($arr[$_SERVER['HTTP_HOST']])) { $darr = $arr[$_SERVER['HTTP_HOST']]; } else { $dom = explode(".", $_SERVER['HTTP_HOST']); $topdom = implode(".", array_slice($dom, -2)); if (isset($arr[$topdom])) { $darr = $arr[$topdom]; } } if (isset($darr)) { return $darr[1]; } else { return $original_email_address; } } function sender_name($original_email_from) { $g = stripcslashes(get_option($this->pluginname . "_mail_emailsettings")); $arr = json_decode($g, true); if (isset($arr[$_SERVER['HTTP_HOST']])) { $darr = $arr[$_SERVER['HTTP_HOST']]; } else { $dom = explode(".", $_SERVER['HTTP_HOST']); $topdom = implode(".", array_slice($dom, -2)); if (isset($arr[$topdom])) { $darr = $arr[$topdom]; } } if (isset($darr)) { return $darr[0]; } else { return $original_email_from; } } function tester() { $g = stripcslashes(get_option($this->pluginname . "_mail_emailsettings")); $arr = json_decode($g, true); if (isset($arr[$_SERVER['HTTP_HOST']])) { $darr = $arr[$_SERVER['HTTP_HOST']]; } else { $dom = explode(".", $_SERVER['HTTP_HOST']); $topdom = implode(".", array_slice($dom, -2)); if (isset($arr[$topdom])) { $darr = $arr[$topdom]; } } if (isset($darr)) { print_r($darr); } } function mail_logger($args) { $str = date("Y-m-d"); $str .= " | " . date("H:i:s"); $str .= " | " . $args['to']; $str .= " | " . $args['subject']; fwrite($this->logfile, $str . "\n"); return $args; } function help() { ?>
Email log |