public static function getHostname()
 {
     $hostname = getHostname();
     // we get different results on different operating systems
     // make sure the hostname is not the FQDN
     $dotPos = strpos($hostname, '.');
     if ($dotPos) {
         $hostname = substr($hostname, 0, $dotPos);
     }
     // all done
     return $hostname;
 }
Beispiel #2
0
 /**
  * @return AddressCollection
  */
 public static function parse($addressCollection)
 {
     $result = imap_rfc822_parse_adrlist($addressCollection, getHostname());
     $addressCollection = new static($result);
     return $addressCollection->map(function ($user) {
         if (!$user->host) {
             throw new Exception('Missing or invalid host name');
         }
         if ($user->host == '.SYNTAX-ERROR.') {
             throw new Exception('Missing or invalid host name');
         }
         $mailAddress = new MailAddress();
         if (property_exists($user, 'personal')) {
             $mailAddress->setUserName($user->personal);
         }
         $mailAddress->setMailbox($user->mailbox);
         $mailAddress->setHostname($user->host);
         return $mailAddress;
     });
 }
Beispiel #3
0
 function setHeaders()
 {
     $this->_headers = "Content-Type: text/html; charset=iso-8859-1\n";
     $this->_headers .= "From: <" . $this->_sender . ">\nReply-to: <noreply@" . getHostname() . ">\n";
     $this->_headers .= "X-mailer: php\r\n";
     $this->_headers .= "X-Priority: 1\r\n";
 }
Beispiel #4
0
function isStaging()
{
    return getHostname() === HOSTNAME_STAG;
}