1<?php 2/** 3 * DokuWiki Plugin smtp (Helper Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr <andi@splitbrain.org> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12class helper_plugin_smtp extends DokuWiki_Plugin { 13 14 /** 15 * Return a string usable as EHLO message 16 * 17 * @param string $ehlo configured EHLO (ovverrides automatic detection) 18 * @return string 19 */ 20 static public function getEHLO($ehlo='') { 21 if(empty($ehlo)) { 22 $ip = $_SERVER["SERVER_ADDR"]; 23 if (empty($ip)) 24 return "localhost.localdomain"; 25 26 // Indicate IPv6 address according to RFC 2821, if applicable. 27 $colonPos = strpos($ip, ':'); 28 if ($colonPos !== false) { 29 $ip = 'IPv6:'.$ip; 30 } 31 32 return "[" . $ip . "]"; 33 } 34 return $ehlo; 35 } 36 37} 38 39// vim:ts=4:sw=4:et: 40