website membership emails stopped working after installing simple forum

10 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 18, 2017   (RSS)

By wizzle - July 9, 2017

Early in the week I set up website membership plugin and got the emails working.  When new members signed up it sent the welcome email with their password.

Today I installed the simple forum plugin.  While testing, I realized that subscription emails were not being sent.  I test the new member signup emails and they have stopped working also.

I ran a testmail.php file to verify that server email is still working fine.

Each time I create a new user now, I get 2 errors on the developer log

E_USER_NOTICE: Failed to create cache directory /tmp/524f7090b2a216dc49db63c7038ef49c (total iterations: 1, send time: 0.01s, emails sent: 0, total emails sent: 0, total script time: 0.07s)

/home/gwche/gwche.org/cmsb/lib/common.php (line 1466)

and

E_WARNING: mkdir(): Too many links
/home/gwche/gwche.org/cmsb/3rdParty/SwiftMailer5/classes/Swift/KeyCache/DiskKeyCache.php (line 273)
http://www.gwche.dreamhosters.com/user-signup.php

Note that the gwche.org is the site I'm building, but gwche.dreamhosters.com is a mirror site created in my hosting account while I am waiting to transfer the gwche.org domain name.  This has not been an issue at all but I suppose it could be part of the problem.

Greg Williams

By Dave - July 10, 2017 - edited: July 11, 2017

Hi wizzle, 

Looks like an error with the SwiftMailer component we're using.  We're updating it in the next release.  Here's some instructions on updating it yourself.

  • Ensure you're using CMSB 3.00 or better
  • Rename /3rdParty/SwiftMailer5/ to SwiftMailer5_old
  • Download and unzip the attached file and upload the /SwiftMailer5/ folder to /3rdParty/
  • Test and see if it works now.

Hope that helps!  Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

By wizzle - July 11, 2017

I tried that but it doesn't seem to have fixed anything.

I checked the file called "version" in in the new swiftmailer folder and the _old... both of them say 5.4.1

I am using CMS Builder v3.10 (Build 2139)

PHP v7.0.14

As a side not, I created my own plugin to send an email to the website members when a new event is posted (a new record is created in the "events" table). I started with EmailOnApproved and modified it.  These emails seem to be working fine.  The ones not working are in the forums, and when new members create an account.

Greg Williams

By Dave - July 11, 2017

Hi Wizzle, 

Apologies, I think you're right, and I did not upload the correct version.  Can you try again with this version (attached)?

Just confirm first that the "VERSION" file says "Swift-5.4.8".  I saw they made some code improvements that look like it might fix the issue.  If it doesn't we can investigate further.

The reason other mail() code might work when this doesn't is because it's an issue with the SwiftMailer library and how it deals with temp folders and files.  There are many benefits to using this 3rd party library but in this case a bug in it is causing troubles.

Let me know what you find out.  Thanks!

Dave Edis - Senior Developer
interactivetools.com
Attachments:

SwiftMailer5.zip 214K

By wizzle - July 11, 2017

These are the new errors...

The Swift_Transport_MailTransport class is deprecated since version 5.4.5 and will be removed in 6.0. Use the Sendmail or SMTP transport instead.
/home/gwche/gwche.org/cmsb/3rdParty/SwiftMailer5/classes/Swift/Transport/MailTransport.php (line 45)

mkdir(): Too many links
/home/gwche/gwche.org/cmsb/3rdParty/SwiftMailer5/classes/Swift/KeyCache/DiskKeyCache.php (line 273)

 Failed to create cache directory /tmp/061f2669b80ae4816e8f0557524aadad (total iterations: 1, send time: 0.16s, emails sent: 0, total emails sent: 0, total script time: 1.59s)
/home/gwche/gwche.org/cmsb/lib/common.php (line 1466)

require_once(/home/gwche/gwche.org/cmsb/3rdParty/SwiftMailer5/swift_required.php): failed to open stream: No such file or directory
/home/gwche/gwche.org/cmsb/lib/common.php (line 1369)

I'm going to spend some time to sort through them and see what I can figure out, but I thought it was worth copy/pasting real quick to update you on the status.

Thanks for looking into this.

Greg Williams

By Dave - July 11, 2017

Thanks wizzle,  Which PHP version are you running?  We'll look into this on our end as well.  

Dave Edis - Senior Developer
interactivetools.com

By wizzle - July 11, 2017

PHP v7.0.14

Greg Williams

By wizzle - July 12, 2017

after many many... many many many hours of googling, re-googling, and reading stuff I can't even comprehend, I solved this issue.

Swiftmailer tries to create a temporary directory in the default /tmp folder... but for some reason that crashes.  Not sure if it's php 7, or apache, or what, but trying to make a directory in /tmp just fails.  I test this with a simple file i called testmail.php

<?php
mkdir('/tmp/test');
?>

To solve I did this

Step 1. Manually create a new location for swiftmailer to write it's temporary files and make sure it has Write permissions.  I created a folder called swiftTemp in my root directory.

Step 2.  In the file  /cmsb/3rdParty/Swiftmailer5/preferences.php  change this 

if (@is_writable($tmpDir = sys_get_temp_dir())) {
    $preferences->setTempDir($tmpDir)->setCacheType('disk');

to this

if (@is_writable($tmpDir = 'swiftTemp')) {
    $preferences->setTempDir($tmpDir)->setCacheType('disk');

This tells the swiftmailer plugin to use your new folder instead of the default temp folder.

Greg Williams

By Dave - July 18, 2017

Wizzle, 

Glad you got it working and thanks for posting your fix.  That's really helpful.  We'll make sure we get this resolved in the next release.

Cheers!

Dave Edis - Senior Developer
interactivetools.com