Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUserEmail.php
Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | public function sendVerificationEmail(PhabricatorUser $user) { | ||||
$address = $this->getAddress(); | $address = $this->getAddress(); | ||||
$link = PhabricatorEnv::getProductionURI($this->getVerificationURI()); | $link = PhabricatorEnv::getProductionURI($this->getVerificationURI()); | ||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | ||||
$signature = null; | $signature = null; | ||||
if (!$is_serious) { | if (!$is_serious) { | ||||
$signature = pht("Get Well Soon,\nPhabricator"); | $signature = pht( | ||||
"Get Well Soon,\n%s", | |||||
PlatformSymbols::getPlatformServerName()); | |||||
} | } | ||||
$body = sprintf( | $body = sprintf( | ||||
"%s\n\n%s\n\n %s\n\n%s", | "%s\n\n%s\n\n %s\n\n%s", | ||||
pht('Hi %s', $username), | pht('Hi %s', $username), | ||||
pht( | pht( | ||||
'Please verify that you own this email address (%s) by '. | 'Please verify that you own this email address (%s) by '. | ||||
'clicking this link:', | 'clicking this link:', | ||||
$address), | $address), | ||||
$link, | $link, | ||||
$signature); | $signature); | ||||
id(new PhabricatorMetaMTAMail()) | id(new PhabricatorMetaMTAMail()) | ||||
->addRawTos(array($address)) | ->addRawTos(array($address)) | ||||
->setForceDelivery(true) | ->setForceDelivery(true) | ||||
->setSubject(pht('[Phabricator] Email Verification')) | ->setSubject( | ||||
pht( | |||||
'[%s] Email Verification', | |||||
PlatformSymbols::getPlatformServerName())) | |||||
->setBody($body) | ->setBody($body) | ||||
->setRelatedPHID($user->getPHID()) | ->setRelatedPHID($user->getPHID()) | ||||
->saveAndSend(); | ->saveAndSend(); | ||||
return $this; | return $this; | ||||
} | } | ||||
Show All 14 Lines | public function sendOldPrimaryEmail( | ||||
$old_address = $this->getAddress(); | $old_address = $this->getAddress(); | ||||
$new_address = $new->getAddress(); | $new_address = $new->getAddress(); | ||||
$body = sprintf( | $body = sprintf( | ||||
"%s\n\n%s\n", | "%s\n\n%s\n", | ||||
pht('Hi %s', $username), | pht('Hi %s', $username), | ||||
pht( | pht( | ||||
'This email address (%s) is no longer your primary email address. '. | 'This email address (%s) is no longer your primary email address. '. | ||||
'Going forward, Phabricator will send all email to your new primary '. | 'Going forward, all email will be sent to your new primary email '. | ||||
'email address (%s).', | 'address (%s).', | ||||
$old_address, | $old_address, | ||||
$new_address)); | $new_address)); | ||||
id(new PhabricatorMetaMTAMail()) | id(new PhabricatorMetaMTAMail()) | ||||
->addRawTos(array($old_address)) | ->addRawTos(array($old_address)) | ||||
->setForceDelivery(true) | ->setForceDelivery(true) | ||||
->setSubject(pht('[Phabricator] Primary Address Changed')) | ->setSubject( | ||||
pht( | |||||
'[%s] Primary Address Changed', | |||||
PlatformSymbols::getPlatformServerName())) | |||||
->setBody($body) | ->setBody($body) | ||||
->setFrom($user->getPHID()) | ->setFrom($user->getPHID()) | ||||
->setRelatedPHID($user->getPHID()) | ->setRelatedPHID($user->getPHID()) | ||||
->saveAndSend(); | ->saveAndSend(); | ||||
} | } | ||||
/** | /** | ||||
Show All 9 Lines | public function sendNewPrimaryEmail(PhabricatorUser $user) { | ||||
$new_address = $this->getAddress(); | $new_address = $this->getAddress(); | ||||
$body = sprintf( | $body = sprintf( | ||||
"%s\n\n%s\n", | "%s\n\n%s\n", | ||||
pht('Hi %s', $username), | pht('Hi %s', $username), | ||||
pht( | pht( | ||||
'This is now your primary email address (%s). Going forward, '. | 'This is now your primary email address (%s). Going forward, '. | ||||
'Phabricator will send all email here.', | 'all email will be sent here.', | ||||
$new_address)); | $new_address)); | ||||
id(new PhabricatorMetaMTAMail()) | id(new PhabricatorMetaMTAMail()) | ||||
->addRawTos(array($new_address)) | ->addRawTos(array($new_address)) | ||||
->setForceDelivery(true) | ->setForceDelivery(true) | ||||
->setSubject(pht('[Phabricator] Primary Address Changed')) | ->setSubject( | ||||
pht( | |||||
'[%s] Primary Address Changed', | |||||
PlatformSymbols::getPlatformServerName())) | |||||
->setBody($body) | ->setBody($body) | ||||
->setFrom($user->getPHID()) | ->setFrom($user->getPHID()) | ||||
->setRelatedPHID($user->getPHID()) | ->setRelatedPHID($user->getPHID()) | ||||
->saveAndSend(); | ->saveAndSend(); | ||||
return $this; | return $this; | ||||
} | } | ||||
Show All 34 Lines |