The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upgrade to the Swift Mailer Module is Available
There is an updated Swift Mailer module now available for FormTools, thanks to Ben McClure, of TopFloorTech.

Here is the background on this update. Like many others who have posted in this Forum, I had trouble with the old Swift Mailer module. I located an update to the FormTools Swift Mailer module on GitHub, provided by Ben McClure. I spoke with Ben by email, and was told that one of the sites he works with uses FormTools. That site needed to send email out through an external SMTP server Amazon SES SMTP, which uses SSL and/or TLS protocols. Since the official Swift Mailer module on the site was an older version that needed updating, he created an update to the FormTools Swift Mailer module, and placed the new working code copy on GitHub.

I downloaded Ben’s updated FormTools Swift Mailer module from GitHub, and now have it working on a site I manage. I wanted to share the upgrade procedure that worked for me, in hopes this may help others who have been having errors in the old Swift Mailer module.

NOTE: Make sure you have loaded and installed the old Swift Mailer module from the FormTools website before you begin these steps. The upgrade provided by Ben is an overlay of upgraded files, and does not contain all of the files necessary for Swift Mailer to work under FormTools. By installing the old Swift Mailer files first, then the upgraded files from GitHub, you will insure that all needed files are present.

1. Download the Files from GitHub (I did this as a ZIP file), from
and unzip them into a directory on your computer. Rename the unzipped folder swift_mailer to match the FormTools Swift Mailer Module’s folder name.
2. Transfer the entire unzipped and renamed folder to the %formtools%/modules folder for your site. This will copy and overwrite the new upgraded files into your existing %formtools%/modules/swift_mailer folder, leaving any old unmodified files still in place on your site.
3. Go into FormTools, Modules, make sure the Swift Mailer module is enabled, and edit and save the email configuration (SMTP server name, authentication information, etc.) (see my notes below on issues I had with the configuration)

Here are some things I discovered that caused issues on the site I updated, and how I resolved them:

1. Ports 465 and 587 blocked by web host: The site was using a shared IP address on the web host. As a result, the two ports 465 and 587 (used for SSL and TLS on most external SMTP servers) were blocked by the web host and could not be unblocked. I resolved this by purchasing a dedicated IP from the web host, and then requesting that they unblock port 587 so that I could use TLS.

2. How to successfully authenticate Gmail SMTP server: I wanted to use the free SMTP provided by Google, for this particular site. I configured the Swift Mailer module’s SMTP settings as follows:
SMTP Server
Port 587
Username email address of the Gmail account I use for this site
Password password of Gmail account
Authentication procedure login
Encryption Type TLS
Advanced Settings
Use Anti Flooding, email batch size 99, batch wait time 2

On the Test email tab, I changed the “from” email to match the email being used to authenticate the SMTP server, then sent a test email. I received an error, but found that this error actually became part of the authentication process. You will probably get an error at this step, as well, unless you have previously allowed “Unsecure Apps” on Gmail for this particular Gmail account. I logged into the Gmail account I am using to authenticate the SMTP for the module, and saw an email from Google saying someone had tried to log into the account from an application, and if that was me, I needed to allow “unsecure apps” to log into Gmail. I clicked the button to do so. My test emails now worked from within the Swift Mailer module, and email from my forms began working as well.

3. Altho’ I specified a “Custom” email address as “From” in the form’s email template, the email address I put in the Swift Mailer module as the SMTP authenticator shows up as the “from” on the sent email instead. However, the “Name” I put in the Custom area of the email template does appear on the email. This is not an issue for me for this particular site, just an oddity.

I hope this upgraded Swift Mailer module works for others, it is really wonderful to have the forms’ email function working properly on my site again.
Wow, thank you for putting that information out for everyone. I can't wait to try it!!
You're quite welcome. It took me a bit of time to work through many issues I had that didn't relate to the new upgrade code itself, but related to PHP versions on my site, php.ini file settings, the closed port issue, and on and on. I wondered at times if I was actually going to get to a successful conclusion.

I found two issues with the Swift Mail Upgrade files from the GitHub repository, and fixed them, so wanted to post the fix here, in case anyone wants to try this upgrade. I also notified Ben McClure, who placed the Swift Mailer upgrade on GitHub, so that he can fix the problem on his end.

Until that happens, anyone wanting to install and use this upgrade would need to add the following steps.

After first doing the steps in my first post of this thread to download and upgrade the Swift Mailer module:

1) On the GitHub repository, view the code for the file library.php in "raw" and copy/paste it into a new library.php file. For some reason, the copy of the library.php file that downloaded in the ZIP download is not the most current one that is needed, so this gets you the right copy.

2) now edit this library.php file and change line 164 to read

$email->setBody($email_components["html_content"], 'text/html');

3) Upload the new library.php file to your site's formtools swift_mailer folder at %formtools%/modules/swift_mailer

Forum Jump:

Users browsing this thread: 1 Guest(s)