Project

General

Profile

creating tickets from emails

Added by iniyavan karan almost 12 years ago

Hi everyone, I followed the instructions on [[http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails]] and could successful setup issue creation through anonymous emails. Now the problem I am facing is that the newly created issue has only the mail message's body in it, I loose the sender email details and the subject, can there be a way to capture them as well.

thanks and much appreciate any help in this regard
iniy


Replies (7)

RE: creating tickets from emails - Added by Jan Niggemann (redmine.org team member) almost 12 years ago

The subject should be the subject of the created issue.

RE: creating tickets from emails - Added by iniyavan karan almost 12 years ago

I am sorry my bad, the subject does show up. but is there any way to capture the sender's email address as well.

RE: creating tickets from emails - Added by Jan Niggemann (redmine.org team member) almost 12 years ago

The sender is mapped to a redmine user (through the email address), for anonymous mails - none I know of.

RE: creating tickets from emails - Added by iniyavan karan almost 12 years ago

thats exactly the problem here , attached is a screenshot to further your point, bounce anyone?

RE: creating tickets from emails - Added by iniyavan karan over 11 years ago

Got a solution, a very dirty hack with the basic Ruby I could muster. this patch writes the sender's email address in the newly created issue, no formatting but does the job.
replace redmine root\app\models\mail_handler.rb with the patched file to get the sender's email id in the issue body.
the patch is as below

# Creates a new issue
  def receive_issue
    project = target_project
    # check permission
    unless @@handler_options[:no_permission_check]
      raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
    end

    issue = Issue.new(:author => user, :project => project)
    issue.safe_attributes = issue_attributes_from_keywords(issue)
    issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
    issue.subject = cleaned_up_subject
    if issue.subject.blank?
      issue.subject = '(no subject)'
    end
    #patched to write the sender's email id in the body of the new issue created
    issue.description = cleaned_up_text_body + "| This issue is reported by: #{email.header['from'].to_s} |" 

    # add To and Cc as watchers before saving so the watchers can reply to Redmine
    add_watchers(issue)
    issue.save!
    add_attachments(issue)
    logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info
    issue
  end

anyone with a more elegant solution let me know!
thanks
iniy

mail_handler.rb (18 KB) mail_handler.rb mail_handler.rb patched

RE: creating tickets from emails - Added by Mikhail Oleynik about 6 years ago

Any progress on this?

Thank you.

RE: creating tickets from emails - Added by Heiko Böhme over 3 years ago

Does anyone know if there is any progress?

    (1-7/7)