Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honour the ReplyTo field in inbound email #524

Open
cpinfold opened this issue Apr 16, 2019 · 1 comment
Open

Honour the ReplyTo field in inbound email #524

cpinfold opened this issue Apr 16, 2019 · 1 comment

Comments

@cpinfold
Copy link
Contributor

cpinfold commented Apr 16, 2019

Feature Request Description
Currently any new issue email sent to Eventum has the email respond to the From address and ignores the "ReplyTo" field when the email header is set.

Use case: We create emails from another system that sends from a no-reply address and sets the ReplyTo address to the user who initiated the issue. Alternatively a user sending from one account and specifying a replyto at another address.

I have tried to work around this through the workflow (see code sample below), but the method:
Support::getEmailsByIssue($issue_id)
doesn't return the issue creating email in either the
handleNewIssue or getAdditionalEmailAddresses workflow methods. The inline workflow documentation isn't clear that these are called before the issue is fully saved.

As a proof of concept the code below works standalone after the issue is created. I'm sure there are much better ways to do this during email ingestion.

require_once 'init.php';
$issue_id = 12345;

if (!empty($argv[1])) {
        $issue_id = $argv[1];
}
//
// Subscribe emails with Reply-To set on email.
//
// get Email message(s)
$supportEmails = Support::getEmailsByIssue($issue_id);
if(!empty($supportEmails)) {
        $email = $supportEmails[0];
        $sup_id = $email['sup_id'];
        if($email['sup_from'] == 'no-reply@abc.com'
                || $email['sup_from'] == 'no-reply@def.com') {
                $mail = Support::getSupportEmail($sup_id);  // ret MailMessage
                $replyTo = $mail->getHeaderByName('Reply-To')->getFieldValue(); // ret "Xyz" <email@x.y>
                if(!empty($replyTo)) {
                        $usr_id = User::getUserIDByEmail('ADMIN EMAIL ADDRESS');
                        Notification::subscribeEmail(
                                $usr_id, $issue_id, $replyTo,
                                ['closed', 'emails']);
                        // return array($replyTo); // if used in getAdditionalEmailAddresses
                        // send special 'an issue was auto-created for you' notification back to the sender
                        $date = Date_Helper::getRFC822Date($mail->date);
                        $subject = ""; 
                        $prj_id = 3; // Valid project ID if not in workflow
                        Notification::notifyAutoCreatedIssue($prj_id, $issue_id, $replyTo, $date, $subject);
                }

        }
}

I don't think this has come up before so it possibly isn't that common. Any suggestions how to work around in workflow (if possible) would be appreciated.

@glensc
Copy link
Member

glensc commented May 1, 2019

as you asked for any suggestion, my suggestion is to do yourself:

i can add later workflow or extension even to make that extensible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants