# Campaigns not sending emails

**URL:** https://forum.mautic.org/t/campaigns-not-sending-emails/4837
**Category:** General Discussion
**Created:** [August 10, 2016, 4:44pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837 "2016-08-10T16:44:56Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Carlyn](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Carlyn](https://forum.mautic.org/u/Carlyn)
#### Post date: [August 10, 2016, 4:44pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/1 "2016-08-10T16:44:56Z")

</div>

Campaigns not working, meaning its not sending emails with proper trigger.  
  
  
  
Test email works but not the campaign emails.  
  
  
  
Cron job error email from bluehost shared hosting: (different time periods per error)  
  
  
  
mount: /var/fake/myhomeph/var/lib/mysql not mounted already, or bad option  
  
  
  
cp: cannot create symbolic link `/var/fake/myhomeph/etc/./localtime’: File exists  
  
  
  
mount: warning: /var/fake/myhomeph/ramdisk/php seems to be mounted read-write.  
  
  
  
I used php-cli At te start of the cron job command as well as and env prod at the end.  
  
  
  
Any thoughts?

---

<div class="post-metadata">

### Author: ![Carlyn](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Carlyn](https://forum.mautic.org/u/Carlyn)
#### Post date: [August 10, 2016, 4:44pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/2 "2016-08-10T16:44:56Z")

</div>

Campaigns not working, meaning its not sending emails with proper trigger.

Test email works but not the campaign emails.

Cron job error email from bluehost shared hosting: (different time periods per error)

mount: /var/fake/myhomeph/var/lib/mysql not mounted already, or bad option

cp: cannot create symbolic link `/var/fake/myhomeph/etc/./localtime’: File exists

mount: warning: /var/fake/myhomeph/ramdisk/php seems to be mounted read-write.

I used php-cli At te start of the cron job command as well as and env prod at the end.

Any thoughts?

---

<div class="post-metadata">

### Author: ![scottmerselis](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@scottmerselis](https://forum.mautic.org/u/scottmerselis)
#### Post date: [August 10, 2016, 7:55pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/3 "2016-08-10T19:55:23Z")

</div>

Im getting the same issues with the cron jobs setup with the php-cli prefix as well. The one off emails are working just fine. mautic:campaign:trigger was executing the job, but it skipped the email send entirely, but executed a trigger that should of fired after the email was opened.

Thanks in advance for any insight.

---

<div class="post-metadata">

### Author: ![liquid01](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@liquid01](https://forum.mautic.org/u/liquid01)
#### Post date: [August 15, 2016, 7:33am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/4 "2016-08-15T07:33:24Z")

</div>

What version of Mautic do you have currently installed? I had the exact same problem when I updated to version 2.1 on the 12th of August. I had a backup so I rolled back to version 2.0.1 and everything worked fine again… So it might be a bug in the 2.1 version that is responsible.

---

<div class="post-metadata">

### Author: ![JacobCZ](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@JacobCZ](https://forum.mautic.org/u/JacobCZ)
#### Post date: [February 28, 2017, 9:15pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/5 "2017-02-28T21:15:42Z")

</div>

Hey Mautic family 🙂

I have same problem

- email is sent if set-up as ACTION in the FORM
- email is not sent if its part of the CAMPAIGN (and it doesnt matter if CONTACT SOURCE is CONTACT SEGMENT or CAMPAIGN FORM)

Anybody same experience? Is there any progress about all questions above?

Thanks, Jakub

---

<div class="post-metadata">

### Author: ![auto](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@auto](https://forum.mautic.org/u/auto)
#### Post date: [March 31, 2017, 3:21pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/6 "2017-03-31T15:21:36Z")

</div>

Hey i have the same problem as well.  
Mautic 2.7.1 Test emails and email from form actions are working fine. But Campaign email are not sending.

Someone any ideas??  
Contacts are getting in the campaign they just dont get the email

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [March 31, 2017, 9:17pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/7 "2017-03-31T21:17:17Z")

</div>

I’m on Mautic 2.5.1 and have the same issue. When running the campaign trigger from the command line, I get the following error:

[DoctrineDBALExceptionSyntaxErrorException]  
An exception occurred while executing ‘SELECT c.\*, l.lead\_id, l.is\_primary FROM ma\_companies c INNER JOIN ma\_companies\_leads l ON l.  
company\_id = c.id WHERE (l.manually\_removed = 0) AND (l.lead\_id IN ()) ORDER BY l.date\_added, l.company\_id DESC’:  
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to y  
our MySQL server version for the right syntax to use near ‘)) ORDER BY l.date\_added, l.company\_id DESC’ at line 1

[DoctrineDBALDriverPDOException]  
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to y  
our MySQL server version for the right syntax to use near ‘)) ORDER BY l.date\_added, l.company\_id DESC’ at line 1

[PDOException]  
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to y  
our MySQL server version for the right syntax to use near ‘)) ORDER BY l.date\_added, l.company\_id DESC’ at line 1

---

<div class="post-metadata">

### Author: ![auto](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@auto](https://forum.mautic.org/u/auto)
#### Post date: [April 3, 2017, 7:42am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/8 "2017-04-03T07:42:01Z")

</div>

Hey everyone,

I fixed my case, so i am sharing it just in case i help others.  
So, in my case the issue was that cron jobs were not executing because i have been using old version of php in cron jobs. so what i did was to add this in my cron jobs:

/usr/local/php70/bin/

so a complete cron job command that works for me is

/usr/local/php70/bin/php /home/mydomain/public\_html/mautic/app/console mautic:campaigns:rebuild

I hope i help others.  
Just a side note is that i use mautic on a shared server.

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 6, 2017, 7:12pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/9 "2017-04-06T19:12:47Z")

</div>

@auto Do you remember the specific errors generated before you made this change? I’m just curious if the errors are similar to what I posted above.

Thanks!

Ray

---

<div class="post-metadata">

### Author: ![auto](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@auto](https://forum.mautic.org/u/auto)
#### Post date: [April 7, 2017, 8:54am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/10 "2017-04-07T08:54:30Z")

</div>

@gigcity My apologies but no i do not remember the error.  
Have you resolved your problems?

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 7, 2017, 5:20pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/11 "2017-04-07T17:20:54Z")

</div>

I have not. Still working on it.

---

<div class="post-metadata">

### Author: ![redneckbob](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@redneckbob](https://forum.mautic.org/u/redneckbob)
#### Post date: [April 8, 2017, 9:02pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/12 "2017-04-08T21:02:24Z")

</div>

@gigcity @auto @Carlyn @scottmerselis

SELECT c.\*, l.lead\_id, l.is\_primary FROM ma\_companies c INNER JOIN ma\_companies\_leads l ON l.  
company\_id = c.id WHERE (l.manually\_removed = 0) AND (l.lead\_id IN (CONSTANT IS MISSING)) ORDER BY l.date\_added, l.company\_id DESC

I started using Mautic last week so pardon my ignorance, what are the requirement between a company and contacts in relation to campaigns?

This query seems to imply that a company needs to have a contact (aka; lead) attached or the campaign that was constructed included a relationship between a contact and company when non existed.

Do you have a company attached to the contact used in the campaign?

I do and the campaign ran without error. As you can see in the SQL at the bottom of this post, identified at contact #8 and #49. @gigcity SQL statement doesn’t have any values.

The exact moment an error is generated where I typed CONSTANT IS MISSING because the [IN clause](http://www.mysqltutorial.org/sql-in.aspx) is missing a parameter.

Could have a couple issues here, but please post the following:

- OS: the distribution and version. Have you applied all the latest patches? # cat /proc/version

- SQL: name of database server, version, and have you applied the latest patches? # mysql -V

- PHP: run # php -v and # php -m

That query could contain a NULL character as well, but I don’t see the point in that, but, maybe your database isn’t handling NULLs properly.

```auto
SELECT c.*, l.lead_id, l.is_primary FROM mautic_companies c INNER JOIN mautic_companies_leads l ON l.company_id = c.id WHERE (l.manually_removed = 0) AND (l.lead_id IN (8, 49)) ORDER BY l.date_added, l.company_id DESC;
```

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 8, 2017, 9:26pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/13 "2017-04-08T21:26:26Z")

</div>

@redneckbob  
OS: Linux version 3.13.0-95-generic (buildd@lgw01-58) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) )  
SQL: Ver 14.14 Distrib 5.6.32, for linux-glibc2.5  
PHP: PHP 5.6.25 with Zend OPcache v7.0.6-dev  
[PHP Modules]  
bcmath  
bz2  
calendar  
Core  
ctype  
curl  
date  
dom  
ereg  
exif  
fileinfo  
filter  
ftp  
gd  
gettext  
gmp  
hash  
iconv  
imap  
intl  
json  
ldap  
libxml  
mbstring  
mcrypt  
mysql  
mysqli  
mysqlnd  
openssl  
pcntl  
pcre  
PDO  
pdo\_mysql  
pdo\_sqlite  
Phar  
posix  
readline  
Reflection  
session  
SimpleXML  
soap  
sockets  
SPL  
sqlite3  
standard  
tidy  
tokenizer  
xml  
xmlreader  
xmlrpc  
xmlwriter  
xsl  
Zend OPcache  
zip  
zlib

[Zend Modules]  
Zend OPcache

---

<div class="post-metadata">

### Author: ![LilyAF](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@LilyAF](https://forum.mautic.org/u/LilyAF)
#### Post date: [April 8, 2017, 10:02pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/14 "2017-04-08T22:02:18Z")

</div>

I am having a similar problem as described. I set up a campaign which is supposed to send out an email when someone subscribes. I tested it with 2 different email addresses and in the campaign builder it shows that I have been added and says the emails have been sent, but I have not actually received the emails at either one of my email addresses.

I am computer literate but NOT technical and don’t know the first thing about coding, so I need someone to explain to me in laymen’s terms what I need to do to fix this. Thanks!

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 8, 2017, 10:40pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/15 "2017-04-08T22:40:23Z")

</div>

When running this command from SSH:  
php app/console doctrine:migration:migrate

I get the following errors:

Migration 20160606000000 failed during Execution. Error An exception occurred while executing ‘CREATE INDEX ma\_campaign\_leads ON ma\_campaign\_leads (campaign\_id, manually\_removed, date\_added, lead\_id)’:

SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name ‘ma\_campaign\_leads’

@redneckbob it seems that I have 60 or so doctrine:migration things to process. These apparently have not run via the normal upgrade process. In that I’m running a Bitnami instance and have done simple updates using the web UI, I wouldn’t be surprised if many of the other campaign related issues being reported are related to this.

@LilyAF – can you try running the same command? I’m curious if you get the same result.

thoughts?

---

<div class="post-metadata">

### Author: ![redneckbob](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@redneckbob](https://forum.mautic.org/u/redneckbob)
#### Post date: [April 8, 2017, 11:37pm UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/16 "2017-04-08T23:37:37Z")

</div>

@gigcity, Awesome, thanks. I don’t see any reported issues with the IN clause in mysql 5.6.32 and I’m unclear if NULL is acceptable or not in this context. I suspect there is an issue in the Mautic code that doesn’t include lead.id (aka; Contact id).

If everyone else with this exact SQL error is running Ubuntu 14.04.3 with MysSQL 5.6.32 on PHP 5.6.25 then we’ll dig into the platform, otherwise, I’m going to turn back to Mautic.

I’m on a fresh install of 2.7.1 and I’m able to get send an email via Campaign.

Assumptions:

- You’ve already added an email, type Template, to Mautic.
- You’ve setup e-mail in Mautic, tested it, and it works.

To do:

1. Create a Contact
2. Create a Segment
3. Create a Campaign

* * *

1. Contact -\> New -\> only add First Name, Last Name and Email [redneckbob@gmail.com](mailto:redneckbob@gmail.com). Press Save & Close

2. Segments -\> New -\> enter Name (Test Email To Me), Description, Alias and Filter is “Email equals [redneckbob@gmail.com](mailto:redneckbob@gmail.com)”. Press Save & Close. I sit and reload the Contact Segments page until the cron job finishes and the Contacts update. Image: [http://dev-null.com/2017-04-08\_19-02-07.jpg](http://example.com).

3. Campaign -\> New -\> enter Name, Description, select my test category, Publish is Yes and set to yesterday, then launch Campaign Builder.

In Campaign Builder:

- Contact Sources: Contact Segments
- Contact Segments: select Test Email To Me (see step #2 above) and press Add.
- Click the + on the bottom of the Test Email To Me box and take the blue option Select.
- Select Action -\> Send Email
- on Send Email page enter name, execute immediately, email type transactional, and select the email to send (I already added earlier in the week). Press Add when done. Press Close Builder. Press Save and Close.

Now I reload the Campaign’s page until the Actions and Contacts are updated at which point cron sends the email and it shows up in my inbox.

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 9, 2017, 12:28am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/17 "2017-04-09T00:28:57Z")

</div>

@redneckbob – Thanks. About to fire this off. BTW - I need to clarify. My issue is with a 4-week campaign. Week 1 fires but Week 2 never triggers. If yiou don’t mind, I’ll set this Campaign to fire a 2nd email in about 15 minutes. Stand-by.

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 9, 2017, 1:56am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/18 "2017-04-09T01:56:42Z")

</div>

@redneckbob — apologies for the delay. I’m trying to clear a couple of SQL errors and hosed my box a bit. I’ll let you know when I can pull the trigger on that campaign. =)

---

<div class="post-metadata">

### Author: ![gigcity](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gigcity/32/104_2.png) [@gigcity](https://forum.mautic.org/u/gigcity)
#### Post date: [April 9, 2017, 3:40am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/19 "2017-04-09T03:40:50Z")

</div>

@redneckbob — ok. Finished SQL updates and things are working. I’ll post those edits to the other thread.

You should have an email from my system. Once you read that email, you should trigger the 2nd email in the campaign. That’s where I’ve been seeing problems.

---

<div class="post-metadata">

### Author: ![joshfialkoff](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@joshfialkoff](https://forum.mautic.org/u/joshfialkoff)
#### Post date: [September 20, 2017, 11:38am UTC](https://forum.mautic.org/t/campaigns-not-sending-emails/4837/20 "2017-09-20T11:38:26Z")

</div>

Hi,  
I am not able to send emails through a campaign either.  
I have successfully sent a test email.  
There are no errors in the error log.  
CRON jobs are working.  
I have re-added contacts to their segments and made a new identical segment.  
What else should I do?

[Next page](https://forum.mautic.org/t/campaigns-not-sending-emails/4837.md?page=2)
