RFC: attachments
mtymek opened this issue · 1 comments
mtymek commented
I'd like to introduce support for e-mail attachments. This is how message creation could look like:
$message = $mailService->compose(
array('to' => 'johndoe@domain.com'), // headers
'mail/welcome.phtml', // template name
array('userName' => 'JohnDoe'), // variables passed to Zend\View
array(
'invoice.pdf' => new FileAttachment('data/invoice.pdf')
)
);
Problem is that at this moment MtMail can only generate single-part, or "multipart/alternate" messages. In this case, we'd need Mime message similar to this one:
- multipart/mixed
- text/html - message body
- attachment
or, for alternate text:
- multipart/mixed
- multipart/alternat
- text/plain - plaintext body
- text/html - html body
- attachment
This would probably require backwards-incompatible changes to the MailComposer service.
Ideas are welcome :-)
ping @ojhaujjwal
ojhaujjwal commented
+1 about attachments. In addition to that, we may also create a template interface like AttachmentsProviderInterface
if it is useful.
namespace MtMail\Template;
interface AttachmentsProviderInterface extends TemplateInterface
{
/**
* @return array
*/
public function getAttachments();
}