In my project I needed to send html-mails with attachments. I found a solution using phpmailer with method "mail" and some modifications in couch's functions.php and also in phpmailer.php. Also I modified it to include a plain text version as AltBody:
With this you can send a mail with an attachment in couch as follows passing an editable of type 'file' as attachment parameter of send_mail tag:
It works wonderful in couch version v1.4.7.
@KK: It would be great if phpmailer and the attachment option would be included in a future release.
Another improvement could be of passing an array of files as follows: "file1.zip|file2.pdf|file3.png". If anybody modifies it to achieve this I would be glad.
With this you can send a mail with an attachment in couch as follows passing an editable of type 'file' as attachment parameter of send_mail tag:
- Code: Select all
<cms:set attachment="<cms:php>echo str_replace('<cms:show k_site_link />', '../', '<cms:show attachment />');</cms:php>" scope='global' />
<cms:send_mail from='sender@example.com' to='receiver@example.com' html='1' subject='Your subject' attachment=attachment >
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
Any HTML body here ...
</body>
</html>
</cms:send_mail>
It works wonderful in couch version v1.4.7.
@KK: It would be great if phpmailer and the attachment option would be included in a future release.
Another improvement could be of passing an array of files as follows: "file1.zip|file2.pdf|file3.png". If anybody modifies it to achieve this I would be glad.