Project

General

Profile

« Previous | Next » 

Revision 09b32d70

Added by Marc Dequènes almost 16 years ago

  • ID 09b32d703dd0a5924155082fd7743e536fd8231f

[evol] sign outgoing mails, and lot's of fixes and code improvement in mail handling (related to signing, crypting, and preparing/chaining the two)

View differences:

postman
elsif not order.ok
logger.info "Sending reply for rejected message (#{order.msg})"
mail_reply = mail.create_reply
mail_reply.set_content_type("text", "plain", {'charset' => "utf-8"})
mail_reply.set_disposition("inline")
mail_reply.quoted_printable_body = "A message (ID: #{mail.message_id}) apparently from you was rejected for the following reason:\n #{order.msg}"
mail_reply.sign
mail_reply.deliver
msg.delete
next
......
logger.info "Message accepted, processing orders..."
result_list = CommandParser.run(order)
# create reply
logger.info "Sending reply"
mail_reply = mail.create_reply
# create transcript
logger.debug "Preparing reply"
reply_txt = "Hello #{order.user.cn},\n\nFollows the transcript of your commands:\n"
reply_attachments = []
result_list.each do |result|
......
reply_txt << "#{result.message}\n"
reply_attachments += result.refs unless result.refs.nil?
end
# create mail
logger.debug "Preparing mail"
mail_reply = mail.create_reply
if reply_attachments.empty?
mail_reply.set_content_type("text", "plain")
mail_reply.set_disposition("inline")
mail_reply.quoted_printable_body = reply_txt
transcript_part = mail_reply
else
mail_reply.set_content_type("multipart", "mixed", {'boundary' => TMail.new_boundary})
parts = []
p = CyborgHood::Mail.new
p.set_content_type("text", "plain", {'charset' => "utf-8"})
p.set_disposition("inline")
p.quoted_printable_body = reply_txt
transcript_part = p
mail_reply.parts << p
reply_attachments.each do |attachment|
......
mail_reply.parts << p
end
end
mail_reply.crypt(order.user.keyFingerPrint)
# insert transcript
transcript_part.set_content_type("text", "plain", {'charset' => 'utf-8', 'format' => 'flowed'})
transcript_part.set_disposition("inline")
transcript_part.quoted_printable_body = reply_txt
# send reply
logger.debug "Sending mail"
mail_reply.sign_and_crypt(order.user.keyFingerPrint)
mail_reply.deliver
logger.debug "Message processed completely"
logger.info "Message processed completely, deleting"
msg.delete
end
end

Also available in: Unified diff