Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65261235
ManiphestCreateMailReceiver.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jun 2, 08:38
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jun 4, 08:38 (2 d)
Engine
blob
Format
Raw Data
Handle
18038511
Attached To
rPH Phabricator
ManiphestCreateMailReceiver.php
View Options
<?php
final
class
ManiphestCreateMailReceiver
extends
PhabricatorMailReceiver
{
public
function
isEnabled
()
{
$app_class
=
'PhabricatorManiphestApplication'
;
return
PhabricatorApplication
::
isClassInstalled
(
$app_class
);
}
public
function
canAcceptMail
(
PhabricatorMetaMTAReceivedMail
$mail
)
{
$maniphest_app
=
new
PhabricatorManiphestApplication
();
$application_emails
=
id
(
new
PhabricatorMetaMTAApplicationEmailQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withApplicationPHIDs
(
array
(
$maniphest_app
->
getPHID
()))
->
execute
();
foreach
(
$mail
->
getToAddresses
()
as
$to_address
)
{
foreach
(
$application_emails
as
$application_email
)
{
$create_address
=
$application_email
->
getAddress
();
if
(
$this
->
matchAddresses
(
$create_address
,
$to_address
))
{
$this
->
setApplicationEmail
(
$application_email
);
return
true
;
}
}
}
return
false
;
}
protected
function
processReceivedMail
(
PhabricatorMetaMTAReceivedMail
$mail
,
PhabricatorUser
$sender
)
{
$task
=
ManiphestTask
::
initializeNewTask
(
$sender
);
$task
->
setOriginalEmailSource
(
$mail
->
getHeader
(
'From'
));
$handler
=
PhabricatorEnv
::
newObjectFromConfig
(
'metamta.maniphest.reply-handler'
);
$handler
->
setMailReceiver
(
$task
);
$handler
->
setActor
(
$sender
);
$handler
->
setExcludeMailRecipientPHIDs
(
$mail
->
loadExcludeMailRecipientPHIDs
());
$handler
->
setApplicationEmail
(
$this
->
getApplicationEmail
());
$handler
->
processEmail
(
$mail
);
$mail
->
setRelatedPHID
(
$task
->
getPHID
());
}
}
Event Timeline
Log In to Comment