you can trigger the script by adding a checkbox to your post blueprint:
newsletter:
label: Newsletter
type: checkbox
width: 1/2
text: check if it should be marked as newsletter (for sending via email).
Not sure how to start the âsend processâ properly⊠I created a send.php which gets called by clicking on a link/button.
There might a better way to do this.
I think with the new panel widgets this might become awesome!
You could have a panel much like the one for pages, but solely for newsletters:
You can add/edit/delete with normal panel functionality because theyâre basically just pages but also manage them a bit more easily with their own widget?
I personally like the idea with a special user role. Nevertheless there should be an option to specify more recipients by uploading a file (e.g. CSV) with addresses.
EDIT: Now that I look at it the edit button is probably not necessaryâŠ
If (or when) Iâd tackle this⊠Iâd start by delegating the actual email sending to services like Mandrill. Following Kirbyâs docs and try to create an adaptor to communicate with Mandrillâs API.
The hard (or fun) part would be figuring out how to integrate the users from Kirby account system like @carstengrimm mentioned. Statistics/widgets would also be cool.
Totally different approach I reckon @andi242 ⊠Youâve got a long way for sure⊠Kudos
What problems would you see in integrating kirby users? But I agree that using a service provider would be the more reliable solution. I actually started writing a sendgrid adapter yesterday
I never heard of Mandrill, but it appears to be a more direct approach than MailChimp itself.
I (tried to) develop this Kirby integration, just because of privacy concerns of the customer (a.k.a. friend of mine).
He preferred the direct integration, without having to hand over the newsletter recipients email addresses to a âthird partyâ.
Thatâs a little bit of a paranoia, since they use gmail ever since, but who am I to judge?
In addition: any mail-footer-advert is not acceptable.
The Mandrill approach is more reliable, though. To be totally honest, I have my concerns of sending the emails via php scripts in the background, because one does not have any control of aborting, etc. the process.
What came up my mind in the last few days of intense Kirby-forum-time:
have a widget to start sending emails, as @FabianSperrle proposed earlier
I think thatâs going to be hard to achieve, anyway. You canât just stop a PHP script from executing externally based on some input⊠So if you wanted to be able to abort the process you would have to loop over all recipients in JS and execute the send script on a per-address basis. Then you could just break the JS loopâŠ
But then again, all the major providers should accept multiple recipients, so sending 1 or 1000 Mails is just one HTTP request and you canât cancel that anyway (Sendgrid, againâŠ). And obviously thatâs several orders of magnitude faster too (depending on how many emails you actually send).
Let me know if I can be of any help with the widgets or anything else
Since it would not be possible to leave the page while an js-ajax-send-email-progress-bar-thingy is running, an external provider sounds like the only option to have something reliable.
I remember a wordpress plugin which has a background send, progress and abort functionality, guess I need to dig into that.
Mandrill is sweet. +1 for a Kirby email list plugin that integrates with Mandrill. And I believe that Mandrill even has a statistics API, in which case thereâd be the source of stats to then feed into a Kirby widget - just a thought.
@FabianSperrle, I developed a basic modular e-mail setup in K2 awhile ago that utilized sendgrid API. It was very easy to work with, though it never ended up getting used. It allowed the use of different headers, footers and body content and assembled all the html/css before sending. The demo was deploying a single e-mail at a time and wasnât finished. The idea got shot down before I took it any further. If youâd like I can send you the contents though.
I tried to rewrite the plugin from scratch and I guess itâs much better now.
Some of the ideas that were proposed in the forum have been implemented, thank you all.
Hereâs some changes:
no more background processing with shell_exec()
all recipients are native Kirby users now
subscribe and unsubscribe form added
all recipients will be added to bcc: in the email (this should be ok for smaller recipients-lists)
added a widget (min. req. Kirby 2.0.7) to list the latest 5 children of page blog (please adapt if necessary)
Whatâs not working until now: site()->user($username)->delete(); is not working in unsubscribe.php line 29.
I have no idea why. fixed.
My test on my DEV XAMPP on Win7 first had some errors.
After some time I found, that you sometimes have used the short PHP-Tag <? instead of the longer PHP-Tag <?PHP . <?= should be <?PHP echo , but I donât know whether you use this.