Tag Archives: Software

WordPress: Troubleshooting Contact Forms

Down the rabbit holeI’m trying to get a contact form working on our WordPress site, and it is a little more complicated than I thought it might be.

The contact form plugin itself in WordPress. We’re using Contact Form 7. Documentation for Contact Form 7 says something to the effect “we’re sending upteen zillion eMails a day, and CF form “just works” for everybody.  Well, kinda, sorta. There are several other issues involved:

  • an MTA (mail transfer agent) which maybe (?)  has to be on the WordPress server
  • the php_mail() function which is part of PHP (the programming language for WordPress)
  • the wp_mail() function which may or may not call the php_mail() function
  • Restrictions on to and from addresses.

I wanted to just run everything through our Google Mail SMTP account, but that seems to add an additional layer.  So first I started with our blog site which is on another server, and tested whether the contact form worked there. It actually doesn’t,  that is, it appears to send mail correctly from the users’s perspective, but no email was received anywhere.

 

Per this note I checked to see if anything was listening on port 25, the usual SMTP port.

$ netstat -tanpl | grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3030/master
tcp6 0 0 ::1:25 :::* LISTEN 3030/master

$ lsof -i :25
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
master 3030 root 12u IPv4 9667 0t0 TCP localhost:smtp (LISTEN)
master 3030 root 13u IPv6 9668 0t0 TCP ip6-localhost:smtp (LISTEN)

Looks promising.  it appears that both IP4 and IP6 are listening.

So, I created a basic PHP script to test at the server command line, and saved this as testphpmail.php. There are three parameters, the receiver’s address, the subject and the body of the message.

//This is a test of the basic PHP eMail function.

<?php
mail('joeblow@blow.com', "Test PHP Mail", "Test mail from PHP Mail");
?>

Run this script from the command line with the following command:

php -f testmail.php

This worked; I received the eMail. It shows that it comes from root.  At least  I knew that at least the fundamentals are in place on the server.

Checking the mail log,  at /var/log/mail.log I see the following:

$ cat/var/log/mail.log
May 20 14:28:17 li239-124 postfix/pickup[28709]: 11864F123: uid=0 from=<root>
May 20 14:28:17 li239-124 postfix/cleanup[28806]: 11864F123: message-id=<20160520142817.11864F123@localhost>
May 20 14:28:17 li239-124 postfix/qmgr[3039]: 11864F123: from=<root@localhost>, size=351, nrcpt=1 (queue active)
May 20 14:28:17 li239-124 postfix/smtp[28808]: 11864F123: to=<lkkg@myserver.org>,
relay=aspmx.l.google.com[173.194.204.27]:25, delay=0.21, delays=0.01/0.01/0.1/0.09, 
dsn=2.0.0, status=sent (250 2.0.0 OK 1463754497 e92si18328547qga.115 - gsmtp)

So this shows that the message was sent, using root@localhost as the sender’s address and my work eMail as the target.  And indeed, I received this email at work.

I checked the log file at /var/log/mail.log which presented various points of interest…including the fact that we are running the Postfix sendmail email server.  But there is also a status=bounced message for IP6.

$ cat /var/log/mail.log 
May 20 13:50:15 li239-124 postfix/pickup[13030]: 2973DF23B: uid=33 from=<www-data>
May 20 13:50:15 li239-124 postfix/cleanup[14078]: 2973DF23B: message-id=<49922f80371c574883b8b8d699f47d9b@blog.kidsgardening.org>
May 20 13:50:15 li239-124 postfix/qmgr[3039]: 2973DF23B: from=<www-data@localhost>, size=869, nrcpt=1 (queue active)
May 20 13:50:15 li239-124 postfix/smtp[14080]: 2973DF23B: to=<lkkg@myserver.org>, relay=aspmx.l.google.com[2607:f8b0:400d:c08::1a]:25, delay=0.41, delays=0.01/0.01/0.09/0.3, dsn=5.7.1, 
status=bounced (host aspmx.l.google.com[2607:f8b0:400d:c08::1a] said: 550-5.7.1 [2600:3c03::f03c:91ff:fe6e:916c] Our system has detected that this 550-5.7.1 message does not meet IPv6 sending guidelines regarding PTR records 550-5.7.1 and authentication. 
Please review 550-5.7.1 https://support.google.com/mail/?p=ipv6_authentication_error for more 550 5.7.1 information. a139si18154032qkc.140 - gsmtp (in reply to end of DATA command))
May 20 13:50:15 li239-124 postfix/cleanup[14078]: 8DAAAF23C: message-id=<20160520135015.8DAAAF23C@localhost>
May 20 13:50:15 li239-124 postfix/bounce[14081]: 2973DF23B: sender non-delivery notification: 8DAAAF23C
May 20 13:50:15 li239-124 postfix/qmgr[3039]: 8DAAAF23C: from=<>, size=3381, nrcpt=1 (queue active)
May 20 13:50:15 li239-124 postfix/qmgr[3039]: 2973DF23B: removed
May 20 13:50:15 li239-124 postfix/local[14082]: 8DAAAF23C: to=<www-data@localhost>, relay=local, delay=0.01, delays=0/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
May 20 13:50:15 li239-124 postfix/qmgr[3039]: 8DAAAF23C: removed
root@li239-124:~# dpkg -S 'which sendmail'
dpkg-query: no path found matching pattern *which sendmail*.
root@li239-124:~# netstat -tanpl | grep:25
grep:25: command not found
root@li239-124:~# netstat -tanpl | grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3030/master
tcp6 0 0 ::1:25 :::* LISTEN 3030/master

Just to be sure, I ran the PHP script again having it send to my home email address which is outside my work domain.  This bounced and I didn’t receive it at the home address.  Now,  in theory, this might not be a bad thing, since all of the Contact Form 7  messages from the blog page should be sent to an address within the same domain, like customerservice@myserver.com.

So far, then we’ve established:

  • PostFix is installed on the blog’s server.
  • Contact Form 7 shows that it is sending message, but the messages are bouncing.  (Hmm…I wonder what I’ve been missing all those times? )

This is so typical of IT. You think you’re troubleshooting an issue on one server, and upon investigating the same issue on another server that you think is working…you find that it isn’t and down the rabbit hole you go!

FileMaker 15

filemaker

FileMaker has updated to version 15 for all platforms. This version includes a ton of bug fixes, heightened security, and some internal changes, as opposed to visual changes. In fact it almost looks and acts the same as version 14.

There is a fair amount of grousing going on in the FileMaker forums about the paucity of new features and (yet another) increase in the effective price. I’m afraid that FileMaker is pricing themselves completely out of the low-end market, although a single copy can be had for education or nonprofits for $197 on Amazon. (Regular price $329).  This is a perfectly respectable deal, and you might want to consider at least one copy for end-user database needs especially if you use Macs, or loath Microsoft Access. FileMaker is my database of choice for front-ends for mySQL (via ODBC), managing eMail lists, and creating tables and inspecting data of all kinds.

FileMaker comes with some pre-built database applications called “Starter Solutions”. Some of these  have been updated for version 15.  I did my expense reporting for a recent trip in the Expense solution, and it makes an attractive listing sorted by categories of all your trip expenses.  Here’s the data entry screen.

Screenshot_051716_035903_PM

Here’s the report:

Expense Report

The application can be hosted on FileMaker server and accessed in a web browser, or run within a standalone copy of FileMaker on a Mac or PC, or run on an iPhone or iPad using the free FileMaker Go app.

There is provision for storing an image of each receipt.  If you run the application on an iPad, you can snap a picture of a paper receipt, or enter a bar-code.  Pretty slick!

 

WordPress: Fix the File Upload Size Limit

On our WordPress site we want to allow the site manager the ability to upload PDF files which can then be downloaded by our blog viewers. While working out this process we ran into a problem with the file size; any file larger than 2 megabytes was not allowed to be uploaded to the site.

Rather than having this setting located somewhere within WordPress, it turns out that the setting is set by the PHP installation.  (PHP is the language that WordPress is written in, and WordPress the application is written as a series of PHP files).

As I was working through this issue, the first embarrassment was that I couldn’t even find the WordPress installation on my Linux server. Usually WordPress is supposed to be installed somewhere relatively transparent, like the /var/html/wordpress folder. Instead mine was buried under  /srv/www/li999-999.members.linode.com/public_html; somehow related to my virtual host from Linode

As my plumber says, when looking at the latest plumbing problem in our basement, “I wonder why they did that?”  Whatever. The way I finally found this out was to search for the one file that is in every WordPress site; wp-config.php.  I did this by firing up the FileZilla FTP program, and doing a search for remote files.

SearchRemoe

Having found the root directory of my WP installation,  I now needed to find the location of the PHP configuration file. I used a similar search in FileZilla and came up with two php.ini files.  Which was the “real” one?

Actually, I didn’t need to do that. Instead, I needed to get to have a script that calls the phpinfo() function which displays a nice list of all the php configuration parameters. Placed in the root directory of my web server, and then called from a web browser, this script displays all of the inner workings of the php configuration of my site.  Here’s the script:

<?php
// Show all information, defaults to INFO_ALL
phpinfo();

?>

This script is saved as GetPHPInfo.php and copied back to the root directory of the web server.

http://mywebsite/GetPHPInfo.php

Call this script in the web browser and it produces  the following:

PHP1

The above is just the tip of the iceberg. Scrolling waaaay down, I find the following parameter in the “core” section of the page:

php2

That is the size restriction, and it is this parameter that I need to change.  I’m thinking that 12 megs should be plenty.  Looking back up top in the 6th line, I see the “Loaded Configuration File” is located at:  /etc/php5/apache2/php.ini  This is the file I’m going to change. So, its back to FileZilla to find it, download it and edit it in Notepad++

PHPini

I downloaded the wp-config.php file to my local machine using FileZilla.  Then I edited the file using Notepad++. to change the  2M to 12M.  Then I uploaded the file via FileZilla back to the web server.

At this point I needed to reboot the web server, Apache2. Depending on the your installation, there are a couple ways to do this at the command line:

$ sudo /etc/init.d/apache2 restart

Or,  in the case of the lazy systems administrator, I just rebooted the whole server. This takes less than two minutes.

The result is now we can upload files that are a maximum of 12 megabytes in size.

I get to do this on another WordPress server too.  Oh joy!

Slack for Non-Profits – EMail is Obsolete!

Back in February I wrote about using Slack for our non-profit organization.  I’ve since introduced this to another organization that I’m a board member for, and it appears to have really taken off for this other group. One thing I hadn’t mentioned last time was the Slack for Non-Profits program, which provides all of the benefits of a paid Slack account to a qualifying non-profit for free. These include:

  • A fully searchable archive with unlimited messages
  • Unlimited external integrations
  • Simple usage statistics
  • Custom message retention policies
  • Guest access
  • Premium support
The first point I should emphasize is that even if you don’t qualify for the non-profit program, Slack is still highly useful. In particular, we were looking for the ability to invite users to our Slack board, without having those users be able to see the entire list of channels. For example,  here is our channel list.

You’ll note that this full list includes the standard default channels, “general”, and “random”.  All of the other channels are related either to committees, or for planning of upcoming events.  The committees include:

  • board
  • fundraising
  • publicity
The planning channels include
  • 2015_fall_concert
  • 50th_anniversary 
  • auditions_2015fall 
You may have gathered that our group is a music group.  We’re actually a semi-professional choral group of 36 acapella singers that sing five centuries of choral music.  
The calendar channel is a special channel. This is an integration which displays calendar events that are entered into our organization’s Google Calendar. You’ll note that the non-profit plan includes “unlimited integrations”. (The free plans include 10 integrations). Integrations are a whole separate discussion, but briefly, they allow events and information from other applications to appear (be copied to) a Slack channel and vice-versa. I’ve used this especially for integrating Trello project management boards with Slack channels. So, for example, I may have a Trello board for a particular grant application, and have additions and changes in the Trello board appear within the fundraising channel. 
Ok.  Back to the other enhancements. An advantage of the non-profit plan is that we’ll be able to create a channel for, say the Concert Committee, and invite all the members of that committee to the channel. Those members can be restricted so that they can’t see the board channel, or indeed any other committees that they aren’t a member of. This is great for us…as we’ll probably end up having channels for each committee, as well as an AllMembers channel for everyone who sings with us.  
The other major advantage of non-profit status is that you can use the enhancements for no cost. I was interested to see that the Slack crew said if we had an actual paid account, we’d be spending US$640.00 per year, and that is just for our current subset of our full membership, (basically the board of directors). By the time we add our committee channels and the rest of our members, we’ll be getting the equivalent of at least double that amount. Not bad for a few minutes of filling out the application.  
What are you waiting for?  Apply for a Non-Profit Slack account now.  You’ll need a 501c(3) letter, testifying that you are granted non-profit status.

And I’d love to hear how you are using Slack in your non-profit; send a note or leave comments. 

FileZilla

I have taken over our webmaster’s job, following the departure of that esteemed and highly valued person a week or so ago. We are going to miss him in ways that we haven’t even figured out yet.

I’m scrambling to find out everything that the webmaster does…and finding that his tool set was basic in the extreme; roughly a text editor and and the superb open-source FTP program called FileZilla. With these two tools, he maintained two major web sites, and several minor mini-sites, built on-demand web pages for special projects, ran our DNS, managed our open-source survey system called LimeSurvey, did our analytics and search-engine-optimization (SEO), slung PHP code like a master, and managed a series of third-party advertising tiles and several mailing lists.  Whew!  

A Database for Grant Research

I put together a grants database screen (click to view full size) to consolidate information for funding sources, and to track dates and interactions.

It is definitely an evolving project, but contains the basic information need to contact the funder, the deadline dates involved, the funder’s areas of interest, and the typical range of a grant award.

So far, I’ve been concentrating on foundation funding. Many foundations typically ask for a letter of interest before you put together a full proposal. So, I’ve included multiple date fields, a deadline for a letter of interest, a deadline for a full proposal, and a date when they announce their award.

Originally I thought that this database would be mostly for research, but after working with the online grants database, Grantstation, I think I will reserve this database for funders that I really expect to submit to. Some ideas for future enhancements include:

  • Links to standard “boilerplate” paragraphs that are used in an application. 
  • Links to edit the proposal or letter directly in Word. 
  • Links to the PDFs of the proposal. 
  • Reports that create a grants calendar. 
Before anyone comments that “you should really use X software” for this purpose, I just want to say that I’ve used several in the past, including DonorPerfect and Blackbaud, and evaluated many others. Right now, I’m in the process of rethinking my entire workflow automation from the ground up, and this very lightweight approach is just what I’m looking for. Plus its in FileMaker, so I can run it on my Windows machines at work, or my Macs at home.     

Alabama Eye Bank runs on FileMaker Pro.

Over at  Tech for Home Healtcare,  I’ve described how the Alabama Eye Bank uses FileMaker Pro to manage the process of receiving donated corneas thorough finding a recipient and scheduling the surgery. It is an amazing application that shows the cross-platform versatility of FileMaker, hosted on Windows servers, and deployed to Mac workstations, iPads, and iPhones.