andris9/mailcomposer — pull request #2 by seppuku (2012-03-15 08:26:36+00:00)
Title: Feature enhancement: Set sender independent of from property

Hi Andris,

I have a use case where i need to set the envelope "from" independent of the user facing "from" header. I tweaked mail composer so that you can set a from and sender property as message options. If sender is only specified, that will be used for both envelope from and from header. Same thing if from is specified only. But if both sender and from are specified, then sender will be used on envelop and from will be in the header. Hope that makes sense.

ex. User sees "hi@xyz.com", but "mail@xyz.com is on envelope"
mailcomposer.setMessageOption({
from: "hi@xyz.com",
sender: "mail@xyz.com",
to: "andris@node.ee",
body: "Hello world!",
html: "Hello world!"
});

ex."hi@xyz.com" is used on both envelope and from header
mailcomposer.setMessageOption({
from: "hi@xyz.com",
to: "andris@node.ee",
body: "Hello world!",
html: "Hello world!"
});

ex."hi@xyz.com" is used on both envelope and from header
mailcomposer.setMessageOption({
sender: "hi@xyz.com",
to: "andris@node.ee",
body: "Hello world!",
html: "Hello world!"
});

I also updated the unit tests to reflect the changes. Oh and sorry about the formatting issues, my editor messed it up slightly. Let me know what you think.

-Radii