How to create issue from email/webpage form?

There is a php form in our website. After submitting the form, email will go to our company's email address (sample: support@company.com). Also, an issue is being created in Jira from that email/form. Those setting has been enabled already in jira. To send the email, an email of our company is to set in Form filed in the php. Without that gateway, message can't be send to our email address. So, the sample code is:

 

$fromName = $_POST['username'];
$fromEmail = $_POST['email'];
$mail->From = 'any@company.com';
$mail->FromName = 'Company';
$mail->addAddress('support@company.com', 'Company');
$mail->addReplyTo($fromEmail, $fromName);
$mail->Body    = "<p>You have got a email from <b>{$fromName}&lt;{$fromEmail}&gt;</b></p>";
$mail->Body .= "<p><b>The actual message is given bellow</b></p>";

 

The problem is, at jira, it says:

You have got a email from userName<user@gmail.com>

The actual message is given bellow

And it sets  our email address (any@company.com which we set in $mail -> From) as reporter in stead of user's email (user@gmail.com, the email we collect by $fromEmail)  for that issue. So, the problem is, when we reply at that issue, it goes to any@company.com instead of user's email address (user@gmail.com). How to fix this?

1 answer

Tarun Sapra Community Champion Dec 20, 2017

Is the user's email actually mentioned in the "from" mail section in your company mailbox which the JIRA reads, can you confirm that

Tarun Sapra Community Champion Dec 20, 2017

Also from the official docs, this is what is supported, without requiring the plugin. You have to use it while configuring the mail handler

Default Reporter
Specify the username of a default reporter, which will be used if the email address in the From: field of any received messages does not match the address associated with that of an existing JIRA user — for example, a JIRA username such as emailed-reporter

(info) Note:

This option is not available if the Create Users checkbox is selected.
Please ensure that the user specified in this field has the Create I ssues project permission for the relevant Project (specified above) as well as the Create Comments project permission for the other relevant projects to which this mail handler should add comments.
When an issue is created and this option is specified, the email message's From: field address is appended in a brief message at the end of the issue's Description field, so that the sender can be identified.

Thanks for your response. I don't have access to the company mailbox right now. I see all the messages at jira issue collector. I'll try to access the mailbox directly and confirm. By the way, for sending the message from website, phpMailer has been used: https://github.com/PHPMailer/PHPMailer/blob/master/examples/contactform.phps 

I haven't found any installed plugin for email handling. That means, it was configured without plugin probably.

existing-add-on.jpg.

By the way, here is the configuration what I have found in jira:

 

Screenshot from 2017-12-20 18-41-46.pngScreenshot from 2017-12-20 18-45-55.pngScreenshot from 2017-12-20 18-47-51.png

Tarun Sapra Community Champion Dec 20, 2017

As mentioned in the configuration "You haven't provided default reporter" , thus if the "from" email address is not mapped to any username then it will be ignored. Thus, your company address is mapped to some username which becomes the default repoter.

okay, but I don't want to set any default reporter. I want sender's email address as reporter. Sender can be new or any existing jira user. I want it to generate from the input of the form.

$fromEmail = $_POST['email'];

 What should I do then?

By the way, I've tried with checking Create Users checkbox. still no change!

 

Screenshot from 2017-12-21 18-05-03.png

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

523 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you