Lilianne E. Blaze wrote:
Sergiu Dumitriu wrote:
Lilianne E. Blaze wrote:
Hello,
Here's the newest version.
Basically it bridges XWiki.sendMessage to MailSenderPlugin.
It uses Reflection, so no circulars, but it's not exactly pretty.
The patch
cannot be applied yet, since it introduces a regression I'd
like to fix first.
The old sendMessage allowed indeed to set a Subject inside the content
(as a mail header), which is extracted (when found) and passed to the
plugin's sendTextMessage method.
The old sendMessage passed headers+body as-is to SMTPClient.
The problem is that ALL kinds of headers were
allowed inside the text
content, not just the subject, and with this patch these headers are
discarded.
Ok.
Here's what I'm thinking - remove subject extraction from the patch,
instead add a new method to MailSender plugin, like
sendRawMessage(String from, String to, String rawData), which acts more
like old SMTPClient, and add header extraction/handling logic there.
Would that be ok?
Yes, that would work.
What the parser needs to do is find try to determine if the content
starts with headers (keyword: some value), and while a completely blank
line isn't found (and for failsafe, while the line still matches this
pattern) add each header to the contructed Mail object.
--
Sergiu Dumitriu