mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-12-21 23:08:54 -05:00
Parse from/to from the mail headers if possible
This commit is contained in:
parent
7fe655fdac
commit
fb91dd0902
@ -41,7 +41,9 @@ module MailCatcher::Mail extend self
|
||||
@add_message_query ||= db.prepare("INSERT INTO message (sender, recipients, subject, source, type, size, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))")
|
||||
|
||||
mail = Mail.new(message[:source])
|
||||
@add_message_query.execute(message[:sender], JSON.generate(message[:recipients]), mail.subject, message[:source], mail.mime_type || "text/plain", message[:source].length)
|
||||
sender = (mail.from && !mail.from.empty?) ? mail.from : message[:sender]
|
||||
recipients = (mail.to && !mail.to.empty?) ? mail.to : message[:recipients]
|
||||
@add_message_query.execute(sender, JSON.generate(recipients), mail.subject, message[:source], mail.mime_type || "text/plain", message[:source].length)
|
||||
message_id = db.last_insert_row_id
|
||||
parts = mail.all_parts
|
||||
parts = [mail] if parts.empty?
|
||||
|
Loading…
Reference in New Issue
Block a user