Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/engine/PhabricatorMailEmailEngine.php
Show First 20 Lines • Show All 499 Lines • ▼ Show 20 Lines | private function newEmailAddress($address, $name = null) { | ||||
if (strlen($name)) { | if (strlen($name)) { | ||||
$object->setDisplayName($name); | $object->setDisplayName($name); | ||||
} | } | ||||
return $object; | return $object; | ||||
} | } | ||||
public function newDefaultEmailAddress() { | public function newDefaultEmailAddress() { | ||||
$raw_address = PhabricatorEnv::getEnvConfig('metamta.default-address'); | $raw_address = PhabricatorEnv::getEnvConfigStr('metamta.default-address'); | ||||
if (!$raw_address) { | |||||
valerio.bozzolan: ↑ Note that this check is correct, since zero will never be a valid email so we can just have a… | |||||
if (!strlen($raw_address)) { | |||||
$domain = $this->newMailDomain(); | $domain = $this->newMailDomain(); | ||||
$raw_address = "noreply@{$domain}"; | $raw_address = "noreply@{$domain}"; | ||||
} | } | ||||
$address = new PhutilEmailAddress($raw_address); | $address = new PhutilEmailAddress($raw_address); | ||||
if (!phutil_nonempty_string($address->getDisplayName())) { | if (!phutil_nonempty_string($address->getDisplayName())) { | ||||
$address->setDisplayName(PlatformSymbols::getPlatformServerName()); | $address->setDisplayName(PlatformSymbols::getPlatformServerName()); | ||||
} | } | ||||
return $address; | return $address; | ||||
} | } | ||||
public function newVoidEmailAddress() { | public function newVoidEmailAddress() { | ||||
return $this->newDefaultEmailAddress(); | return $this->newDefaultEmailAddress(); | ||||
} | } | ||||
private function newMailDomain() { | private function newMailDomain() { | ||||
$domain = PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain'); | $domain = PhabricatorEnv::getEnvConfigStr('metamta.reply-handler-domain'); | ||||
if (strlen($domain)) { | if ($domain) { | ||||
Done Inline Actions↑ Note that this check is correct, since zero will never be a valid domain so we can just have a nice if, clean and simple. valerio.bozzolan: ↑ Note that this check is correct, since zero will never be a valid domain so we can just have… | |||||
return $domain; | return $domain; | ||||
} | } | ||||
$install_uri = PhabricatorEnv::getURI('/'); | $install_uri = PhabricatorEnv::getURI('/'); | ||||
$install_uri = new PhutilURI($install_uri); | $install_uri = new PhutilURI($install_uri); | ||||
return $install_uri->getDomain(); | return $install_uri->getDomain(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
↑ Note that this check is correct, since zero will never be a valid email so we can just have a nice if, clean and simple.