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