Project

General

Profile

email format that works for redmine:email:receive_imap

Added by Kameron Hott over 12 years ago

Help please. We have an online form that emails to Redmine to create a ticket. The required fields are:
Tracker
Subject
Status
Priority
Assignee
Contact Name
Location
Department
Device Name

The script that runs already provides the Tracker, Subject, and Status. The email body has the rest plus some extra information for the ticket. Here is the form that gets populated with the fields in %% containing the results from the input:

<a>Priority:</a> %opPriority%<br />
<a>Assignee:</a> khott3<br />
<a>Contact Name:</a> %tbContactName%<br />
<a>Contact Email:</a> %tbContactEmail%<br />
<a>Location:</a> %ddLocation%<br />
<a>Department:</a> %ddDepartment%<br />
<a>Device Name:</a> %tbDeviceName%<br />
<a>Phone Number:</a> %tbContactPhone%<br />
<a>Cerner Solution / Module:</a> %ddCernerSolution%<br />
<a>Description Of Problem:</a> %tbProblem%<br />
<a>Username of person who had issue:</a> %tbUsernameHavingIssue%<br />
<a>Application Coach contacted:</a> %fmSMEAttempt%<br />
<a>Name of AC/SME:</a> %tbSMEName%<br />
<a>Software:</a> %ddSoftware%<br />
<a>Has function worked before:</a> %opWorked%<br />
<a>Is issue device specific:</a> %opDevice%<br />
<a>Patient Name:</a> %tbPatientName%<br />
<a>FIN:</a> %tbFIN%<br />
<a>MRN:</a> %tbMRN%<br />

Here is what the email looks like that fails:

Priority: Low
Assignee: mylogin
Contact Name: Bill
Contact Email: mylogin@domain.org
Location: WC
Department: Information Systems (IS,LN)
Device Name: PISV27
Phone Number: 5692
Cerner Solution / Module: All solutions
Description Of Problem: test
Username of person who had issue: test
Application Coach contacted: No
Name of AC/SME: 
Software: Not applicable
Has function worked before: 
Is issue device specific: 
Patient Name: 
FIN: 
MRN: 

If I view the source of the email, it shows as this:

<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><span style="font-size:12pt"><a>Priority:</a> Low<br> <a>Assignee:</a> mylogin<br> <a>Contact Name:</a> Bill<br> <a>Contact Email:</a> mylogin@yrmc.org<br> <a>Location:</a> WC<br> <a>Department:</a> Information Systems (IS,LN)<br> <a>Device Name:</a> PISV27<br> <a>Phone Number:</a> 5692<br> <a>Cerner Solution / Module:</a> All solutions<br> <a>Description Of Problem:</a> test<br> <a>Username of person who had issue:</a> test<br> <a>Application Coach contacted:</a> No<br> <a>Name of AC/SME:</a> <br> <a>Software:</a> Not applicable<br> <a>Has function worked before:</a> <br> <a>Is issue device specific:</a> <br> <a>Patient Name:</a> <br> <a>FIN:</a> <br> <a>MRN:</a> <br></span>

Is there a format that works for someone else? If I just send in an email with the required fields, it works fine but then you loss the other helpe information.

Thank you


Replies (13)

RE: email format that works for redmine:email:receive_imap - Added by William Roush over 12 years ago

Run this task in development mode (RAILS_ENV="development"), what does logs/development.log show?

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

Ok, so I am trying to respond to this with the details and I keep getting rejected as span.

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

Trying just part of it:

  Parameters: {"action"=>"index", "controller"=>"custom_fields", "tab"=>"IssueCustomField"}
Rendering template within layouts/admin
Rendering custom_fields/index

RE: email format that works for redmine:email:receive_imap - Added by William Roush over 12 years ago

Try attaching it as a file, or really the last few hundred lines or so.

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

This is all it has. This is the production.log file contents as we do not have a development database set up. We actually have a test site that is a duplicate of the real site to do our R&D in.

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

To add to this. If I send an email manually to Redmine, it will get processed and a ticket gets created. But if it gets an email from our intranet, it does not get created in Redmine. But if I edit the email and resave it. Mark it unread and place in the inbox, it does get processed. But now if I right click on the email and view the source, it no longer looks like the source above. It now has a bunch of html stuff such as the attached file. Thank you for helping me figure this out. This is a puzzler to me.

RE: email format that works for redmine:email:receive_imap - Added by William Roush over 12 years ago

Kameron Hott wrote:

This is all it has. This is the production.log file contents as we do not have a development database set up. We actually have a test site that is a duplicate of the real site to do our R&D in.

You don't need to, you just need to configure the "development" database and point at production... run the rake task in development mode, it'll output more logs.

The production logs are useless being as they don't log e-mail decisions.

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

Thank you for helping. Attached is the log file. I find it interesting that it does not recognize my fields. What do I need to do?

RE: email format that works for redmine:email:receive_imap - Added by William Roush over 12 years ago

Validation failed: Contact Name can't be blank, Location can't be blank, Department can't be blank, Assignee can't be blank

Any chance you can send that as a plaintext e-mail with line feeds and no formatting?

I think everything being on one line is confusing it.

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

Ok, so I made the website send the email in plain text with the few required fields. Did another log file. Still did not work.

RE: email format that works for redmine:email:receive_imap - Added by Kameron Hott over 12 years ago

I got it working.
What I did was change the mail_handler.rb code a little.
With your help you clued me in on something. Even when I sent in an email in plain text it was still not working for me. So then I put in \n after each line and still the mail was coming across in a single line. So I changed a function a little:

  def plain_text_body
    return @plain_text_body unless @plain_text_body.nil?
    parts = @email.parts.collect {|c| (c.respond_to?(:parts) && !c.parts.empty?) ? c.parts : c}.flatten
    if parts.empty?
      parts << @email
    end
    plain_text_part = parts.detect {|p| p.content_type == 'text/plain'}
    if plain_text_part.nil?
      # no text/plain part found, assuming html-only email
      # strip html tags and remove doctype directive
      @plain_text_body = strip_tags(@email.body.to_s)
      *@plain_text_body.gsub! (/::/,"\n")*
      @plain_text_body.gsub! %r{^<!DOCTYPE .*$}, ''

      logger.info "MailHandler: plain_text_body #{plain_text_body}" 
    else
      @plain_text_body = plain_text_part.body.to_s
    end
    @plain_text_body.strip!
    @plain_text_body
  end

Now with the program putting in the line feed, it took. Even now with sending html email.

Thank you for your help.

RE: email format that works for redmine:email:receive_imap - Added by Jasen Burkett almost 10 years ago

To the originator of this post, you had mentioned that you could email in directly and it would create a ticket. You are infact doing exactly what I am needing to do, however I am getting no where.

Would you mind sharing how you setup the email into redmine, and then how you did the form? It would really help me out....

Thank you.
you can reply to me on here, and or to my email...

    (1-13/13)