Project

General

Profile

Actions

Patch #237

closed

get journal from MailHandler.receive

Added by Nobuhiro IMAI over 16 years ago. Updated over 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Hello,

here attached the patch to get Journal instance
from MailHandler.receive.

Adding notes via email can be done even now,
but I want to get the instance of Journal
that was added to the issue to send
the notify mail by Mailer model.

For example, the following solution will appropriately
handle incoming mails with help from MDA and so on:

Server side:
class MailHandlerController < ApplicationController
session :off

def import
if local_request?
begin
journal = MailHandler.receive(File.read(params[:path]))
Mailer.deliver_issue_edit(journal) if journal
rescue => e
logger.error("#{e.class}: #{e.message}") if logger
end
end
render :nothing => true
end
end

Client side:
require "tempfile"
require "open-uri"

Tempfile.open("mail-to-import") do |t|
t.write(ARGF.read)
t.flush
path = URI.escape(File.expand_path(t.path))
open("http://localhost/mail_handler/import?path=#{path}"){}
end

I intend this for receiving mails without script/runner,
that is too heavy to be invoked by each incoming mail.

Thanks,


Files

journal-from-mail-handler.patch (475 Bytes) journal-from-mail-handler.patch Nobuhiro IMAI, 2008-02-03 11:01
Actions #1

Updated by Jean-Philippe Lang over 15 years ago

  • Status changed from New to Closed

Current trunk now behaves as expected here.

Actions

Also available in: Atom PDF