Tag Archives: WordPress plugins

Wordpress won't send emails

WordPress won’t send emails

It's been long time since I wrote something here. But today I decided to wrote the story of my problem with WordPress. In short words - WordPress won't send email. The problem was raised by the clients, they didn't receive emails from WooCommerce with downloadable item. It was huge problem, as payment was processed successfully, but they didn't receive email with PDF they bought.

Research about not working emails in WordPress

I read tons of threads, articles about problems with WordPress emails. Lot of solutions but none of them actually fixed the problem. It pissed me off, because something like that should work without any problems!

Solving the problem with WordPress emails.

I checked few things:

First of all I wasn't sure if it's a problem with WordPress or with WooCommerce. I'm using PayPal only so i turned on debugging in WooCommerce PayPal settings. I tested the transaction, no email sent. I checked the log, and transaction was completed, but no errors on sending email or anything like that.
Error log from apache was empty so it wasn't pure PHP problem or anything like that.
WordPress use default PHP mail() function for sending emails. In hundreds of threads I checked they suggesting using SMTP protocol instead of using mail function. I installed plugin called Check Email. It's simple plugin that checks if WordPress is sending email correctly. I used standard headers for that, typed the email. Check Email told me that email was sent successfully, but it doesn't mean that email will be delivered. I checked my gmail account and no email at all ;/

So I thought, OK, I will switch to SMTP. I installed plugin called WP-Mail-SMTP. All i need was email account where from I will be able to send emails. So I logged in to my server admin panel (DirectAdmin in my case) and created some dummy email. I received all required information for WP-Mail-SMTP plugin like host and port. I filled all require settings field in plugin's settings. Plugin has also great feature where you can test the email. Everything was great, email should be delivered. I checked my gmail account. Still nothing.

Right direction

That was pretty weird for me. It should have work like a charm! So I decided to log in to fresh created email address and try to send email from there. My server provider has Roundcube system as email system. I created new email and it wasn't delivered. But! I received response email with title: Mail delivery failed: returning message to sender. Email says:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

*****@gmail.com
SMTP error from remote mail server after end of data:
host aspmx.l.google.com [2a00:1450:4013:c01::1a]:
550-5.7.1 [2a01:4f8:101:324d::2 12] Our system has detected that this
550-5.7.1 message is likely unsolicited mail. To reduce the amount of spam sent
550-5.7.1 to Gmail, this message has been blocked. Please visit
550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&answer=188131 for
550 5.7.1 more information. i49si3865415eem.12 - gsmtp

I checked the link in the email. Title of this page is Why has Gmail blocked my messages?

First thing that comes to my mind was that I'm on some kind of blacklist. Maybe I'm a spammer? I used http://mxtoolbox.com/ - great tool that checks if you're not blacklisted. My domain was OK, not blacklisted at all.

What comes to my mind, for test i was using @gmail.com email all the time. I tried to send email to other domain and... email was delivered! I read all that I could and it seems that gmail, yahoo, and few other bigger email providers have algorithms that sometimes block domain, server etc. I wasn't able to find complete solution for this problem. Also, i didn't want to contact Google Customer Center or anything like that. Also i was wondering why I've been blocked by Google?

Fixing Google issue

First of all, i had free domain that I got when I bought the server. I created new account to check if server or domain is blocked. I had the same problem with sending emails from this domain so it was obvious to me, that there's something wrong with the server.

Solution 1 - SPF

SPF is Sender Policy Framework that secure SMTP servers from email spam by email spoofing detection. First of all, I need to know what You must add and where. It should be somewhere in Your server admin panel where You can manage DNS settings. If You can't manage the DNS option You will have to ask Your hosting company to add SPF information to Your DNS records.

It's TXT record with this signature:

v=spf1 [server info here] ~all

Where you have to replace [server info here] with

if You have domain server for your mail server where emailserver.com is domain of Your server

include:emailserver.com

Or server IP address where 111.222.333.444 is mail server IP

ip4:111.222.333.444

Example:

v=spf1 ip4:180.4.140.130 ~all

Important note is that You must use "From" address, that belongs to SPF enabled domain. If You won't provide this information SPF won't work.

I added the record to my DNS panel. I read in 2 or 3 threads that it helped in WordPress not sending email case. But it didn't helped in my case unfortunately. Maybe it didn't worked but I had anti spoofing protection to non-gmail emails 😀

Solution 2 - DKIM

After some further research I finally found working solution DKIM - DomainKeys Identified Mail. It's a way of associating Your domain name with email message.

Unfortunately for the reader it requires integration with server. Simple DirectAdmin or other panel might be not enough in that case. The simplest way is to contact Your hosting provider and require to setup DKIM for Your domain(s).

If You have access to Your server you can do it by yourself. Here is great tool for generating DKIM keys: http://dkimcore.org/ Installation process is different for every server and it depends of the software and OS you're using. I bet that you can find tutorial for Your OS'x using Google Search. For instance here is the tutorial for Postfix and Debian:

https://www.digitalocean.com/community/articles/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy

Hope that one of this option will help You solve Your WordPress email sending problem. If You have any other solution that might help solve this issue please post it in comments below:)

 

 

How to open WordPress admin panel in iframe?

How to open wp-admin in iframe?Hello everybody,

You want to put WordPress in iframe? Sure, no problem. Now, are You trying to log in to wp-admin from iframe? Not possible? Here is the simple solution how to fix opening wp-admin in iframe.

How to open wp-admin in iframe?

Open this file in Your editor:

/YOUR_WORDPRESS_INSTALLATION/wp-includes/default-filters.php

Find and comment out this two lines:

add_action('login_init', 'send_frame_options_header', 10, 0);
add_action('admin_init', 'send_frame_options_header', 10, 0);

 

Background story of wp-admin in iframe problem

What problems we encountered? We had to create solution, that can manage multiple WordPress instances from one admin panel. The problem was, that all websites was on different servers, separate databases etc. So mutlisite is not an option here.

I did small research and found some good wordpress plugins that helps manage multiple wordpress instances:

All of them are really great solutions if You need quick and ready solution.

Both WP-Remote and ManageWP are based on admin panel that creators of these services provides. So You don't have to install anything on Your server. Just create an account on one of them, add Your websites and that's it. Really simple, but unfortunately due to some restrictions in the company I work it was impossible to use one of these solutions. We wanted to be able to change the logo, restyle the admin panels etc. And if we will need any additional functionality that these two solutions provides we will be screwed.

Third solution - InfiniteWP seemed to be best option. You can install it on Your server, you have access to source code, You are able to modify almost anything. I installed it on my localhost and have already some problems.

InifniteWP works like this: You install small plugin on the WordPress website You want to connect with InfiniteWP. It provides You connection data, some secret key etc. When I was trying to add one of the websites I was waiting and waiting and then BUM! Connection was reset. There was nothing in log files, I didn't get any errors and anything. So when I run it with error_reporting(E_ALL) - OMG. Hundreds of warnings etc. After two days of debugging finally I was able to add websites to the InfiniteWP. It works really great on local machine. Clients was satisfied when I showed them the solution via conference room and screen sharing.

More problems started when we putted it on our test server. First of all it worked sooooo slow. After adding website indicator was spinning like forever. All requests took about 5-20s to finish. I fought with that for another 2 days and there was nothing I could really do about it. Googling, reinstalling etc. Nothing!

My approach of dealing with wp-admin in iframe

When I was showing our clients InfiniteWP on my local machine they was quite happy, most of because I was able to run multiple websites without logging in to each website separately. They was able to switch between the websites. InfiniteWP is working kind of a windows with the taskbar where You can switch between applications.

So I thought, we not to create some really simple solution, when I will open WordPress in iframe? Simple switching on JavaScript between iframes. They was quite happy about this, as writing this solution took only 1 day. Fast and simple. The only problem was how to enable opening wordpress admin panel in iframe? But you know the solution already, don't you?:)

WordPress and good WordPress plugins (tech part about this blog)

WordPress and WordPress pluginsOK, lets learn something more about this site(blog) which is run on Worpress with couple WordPress plugins.

At the beginning I thought that I will write it completely from scratch with ZF. But hmmm, when I realize how many things I should create and time I should put into this project I decided for ready solution. If it's a blog, solution is pretty obvious - WordPress. I didn't use it for about 2 years, so I think it might be nice to back to some old solutions.

I downloaded WordPress 3.5.1 from wordpress.org page. Installation as always was very simple, after uploading whole stuff to the server and launching url of the blog we will find simple Step by Step installation. If you know a little bit about web, it shouldn't make you any troubles. After installation it's all about clicking through the configuration pages and set options which suits you best. I used default theme, it's pretty nice, has responsive version (where I found one, or two bugs already, i will fix them later).

OK, so thats it! We can start writing posts, create about me page etc:P W have fully functional blog in 10 minutes. But hey! WordPress has many plugins which increase WP power. So I decided to look around a little bit for some good wordpress plugins and I found really useful stuff. Here are the list of WordPress plugins that are used in this blog:

Akismet

Used by millions, Akismet is quite possibly the best way in the world to protect your blog from comment and trackback spam. It keeps your site protected from spam even while you sleep.

Its bundled with the WordPress installation but it's disabled by default. In order to make it active You need the API key (which is free) from Akismet website

Download link: http://wordpress.org/plugins/akismet/

Crayon Syntax Highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.

Very handful WordPress plugin for syntax highlighting. Tons of options and supported languages. A must have for any developer

Download link: http://wordpress.org/plugins/crayon-syntax-highlighter/

Sociable

Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites.

If you want to have the blog it won't be good if you won't place share/like buttons on your page.

Download link: http://wordpress.org/plugins/sociable/

W3 Total Cache

Easy Web Performance Optimization (WPO) using caching: browser, page, object, database, minify and content delivery network support.

I tried Hyper Cache with WP Minify previously but I couldn't make it work properly on my WordPress installation so I changed it for W3 Total Cache - I think it was good choice, for now everything is working very nice. Even if you do not expect large traffic on your website it's good to have tool like that installed. It will speed up loading time of your website. Faster loading time = more satisfied user:) Very good WordPress plugin!

Download link: http://wordpress.org/plugins/w3-total-cache/

WordPress SEO by Yoast

The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.

Nice WordPress plugin for SEO, when you write post it shows you the SEO statistics and give you advices for optimization.

Download link: http://wordpress.org/plugins/wordpress-seo/

Thats all WordPress plugins I installed on my fresh installation. I will update this post when I will add some new plugins:) Do you know any good plugin for WordPress? Leave info in comments below:)

Our services: