14dc22474SAndreas Gohr<?php 2ee5c0205SAndreas Gohr 3ee5c0205SAndreas Gohruse dokuwiki\Extension\Plugin; 4ee5c0205SAndreas Gohr 54dc22474SAndreas Gohr/** 64dc22474SAndreas Gohr * DokuWiki Plugin smtp (Helper Component) 74dc22474SAndreas Gohr * 84dc22474SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 94dc22474SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 104dc22474SAndreas Gohr */ 11ee5c0205SAndreas Gohrclass helper_plugin_smtp extends Plugin 12ee5c0205SAndreas Gohr{ 1327827474SAndreas Gohr /** 1427827474SAndreas Gohr * Return a string usable as EHLO message 1527827474SAndreas Gohr * 16ee5c0205SAndreas Gohr * @param string $ehlo configured EHLO (overrides automatic detection) 1727827474SAndreas Gohr * @return string 1827827474SAndreas Gohr */ 19ee5c0205SAndreas Gohr public static function getEHLO($ehlo = '') 20ee5c0205SAndreas Gohr { 21*2d25f6d5SAndreas Gohr global $INPUT; 2227827474SAndreas Gohr if (empty($ehlo)) { 23*2d25f6d5SAndreas Gohr $ip = $INPUT->server->str('SERVER_ADDR'); 24ee5c0205SAndreas Gohr if (empty($ip)) { 25ae907de1SMoritz Raguschat return "localhost.localdomain"; 26ee5c0205SAndreas Gohr } 27ae907de1SMoritz Raguschat 28ae907de1SMoritz Raguschat // Indicate IPv6 address according to RFC 2821, if applicable. 29ae907de1SMoritz Raguschat $colonPos = strpos($ip, ':'); 30ae907de1SMoritz Raguschat if ($colonPos !== false) { 31ae907de1SMoritz Raguschat $ip = 'IPv6:' . $ip; 32ae907de1SMoritz Raguschat } 33ae907de1SMoritz Raguschat 34ae907de1SMoritz Raguschat return "[" . $ip . "]"; 3527827474SAndreas Gohr } 3627827474SAndreas Gohr return $ehlo; 3727827474SAndreas Gohr } 384dc22474SAndreas Gohr} 39