I have added a newsletter functionality to Couch CMS, based on a script I found on the web. The script is raw PHP, and I am running it between <cms:php> and </cms:php> tags, which works: except sending the mail itself. I have tried several methods of solving this problem, all to no avail. I am hoping to get some tips or leads from the community.
What did i try:
1/ Send using the script's build-in method, which is using on PHPMailer. It extends the PHPMailer class into its own MLMail class, causing my server to fill up memory. I end with a white screen and 'Backend Fatal: memory size exhausted' errors. It does not matter how big I set the PHP memory, it always ends with this error. (BTW I read on the internet that this was due to the extended class being in a different file than where the mail is sent from; when I fixed that, the memory exhaustion problem kept occurring).
2/ Send using Couch's send_mail tag. However, since I am using raw PHP, I cannot get my dynamically built up mail body to be sent. <cms:send_mail to=... from=... subject=...> echo $mailhtml; </cms:send_mail> will literally send "echo $mailhtml;" as email content !
3/ Using PHPMailer class directly, so without extending it into a MLMail class as the script is doing by default. When I do this, I end up with errors like "Backend fatal error: PHP Fatal error: Uncaught Error: Class 'PHPMailer' not found in /home/xxx/xxx/xxx/public_html/couch/tags.php(3190)" because Couch will try to handle everything in its own way (which I can understand, of course).
For now, the best direction seems to be using the cms:send_mail function, because it is standard Couch, but how can I get the bodytext to appear between the <cms:send_mail> tags in raw PHP code?
All help and hints appreciated !
What did i try:
1/ Send using the script's build-in method, which is using on PHPMailer. It extends the PHPMailer class into its own MLMail class, causing my server to fill up memory. I end with a white screen and 'Backend Fatal: memory size exhausted' errors. It does not matter how big I set the PHP memory, it always ends with this error. (BTW I read on the internet that this was due to the extended class being in a different file than where the mail is sent from; when I fixed that, the memory exhaustion problem kept occurring).
2/ Send using Couch's send_mail tag. However, since I am using raw PHP, I cannot get my dynamically built up mail body to be sent. <cms:send_mail to=... from=... subject=...> echo $mailhtml; </cms:send_mail> will literally send "echo $mailhtml;" as email content !
3/ Using PHPMailer class directly, so without extending it into a MLMail class as the script is doing by default. When I do this, I end up with errors like "Backend fatal error: PHP Fatal error: Uncaught Error: Class 'PHPMailer' not found in /home/xxx/xxx/xxx/public_html/couch/tags.php(3190)" because Couch will try to handle everything in its own way (which I can understand, of course).
For now, the best direction seems to be using the cms:send_mail function, because it is standard Couch, but how can I get the bodytext to appear between the <cms:send_mail> tags in raw PHP code?
All help and hints appreciated !