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 if (empty($ehlo)) { 22 $ip = $_SERVER["SERVER_ADDR"] ?? ''; 23 if (empty($ip)) { 24 return "localhost.localdomain"; 25 } 26 27 // Indicate IPv6 address according to RFC 2821, if applicable. 28 $colonPos = strpos($ip, ':'); 29 if ($colonPos !== false) { 30 $ip = 'IPv6:' . $ip; 31 } 32 33 return "[" . $ip . "]"; 34 } 35 return $ehlo; 36 } 37} 38