# Mautic doesn't send emails to smtp API

**URL:** https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204
**Category:** Product Support
**Created:** [July 18, 2021, 11:52pm UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204 "2021-07-18T23:52:40Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![yukzanaly](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/yukzanaly/32/1769_2.png) [@yukzanaly](https://forum.mautic.org/u/yukzanaly)
#### Post date: [July 18, 2021, 11:52pm UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/1 "2021-07-18T23:52:40Z")

</div>

**Your software**  
My Mautic version is:3.1.0  
My PHP version is:7.3  
My Database type and version is:

**Your problem**  
My problem is:  
mautic doesn’t send emails to smtp API. The stats show that emails have been sent but the smtp doesn’t receive anything. It works well 2 days ago. and to day it something’s wrong

These errors are showing in the log:

[2021-07-18 00:31:06] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO mau57\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau57\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau57\_campaign\_lead\_event\_l…’ at line 2

Steps I have tried to fix the problem: domain/s/update/schema  
and it shows this notif:An error occurred while updating the database. Check log for more details.  
[2021-07-19 06:49:44] mautic.NOTICE: Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing ‘ALTER TABLE mau57\_email\_stats ADD generated\_sent\_date DATE AS (CONCAT(YEAR(date\_sent), “-”, LPAD(MONTH(date\_sent), 2, “0”), “-”, LPAD(DAY(date\_sent), 2, “0”))) COMMENT ‘(DC2Type:generated)’; ALTER TABLE mau57\_email\_stats ADD INDEX `mau57_generated_sent_date_email_id`(generated\_sent\_date, email\_id)’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘ALTER TABLE mau57\_email\_stats ADD INDEX `mau57_generated_sent_date_email_id`(…’ at line 2 (uncaught exception) at /home/wpmmyid/engli.id/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 79 while running console command `doctrine:migrations:migrate`

[2021-07-19 06:49:44] mautic.WARNING: Command `doctrine:migrations:migrate` exited with status code 1

[2021-07-19 06:49:44] mautic.ERROR: [UPGRADE ERROR] Exit code 1; ++ adding generated column generated\_sent\_date → ALTER TABLE mau57\_email\_stats ADD generated\_sent\_date DATE AS (CONCAT(YEAR(date\_sent), “-”, LPAD(MONTH(date\_sent), 2, “0”), “-”, LPAD(DAY(date\_sent), 2, “0”))) COMMENT ‘(DC2Type:generated)’; ALTER TABLE mau57\_email\_stats ADD INDEX `mau57_generated_sent_date_email_id`(generated\_sent\_date, email\_id) \ In AbstractMySQLDriver.php line 79: \ An exception occurred while executing ‘ALTER TABLE mau57\_email\_stats ADD ge nerated\_sent\_date DATE AS (CONCAT(YEAR(date\_sent), “-”, LPAD(MONTH(date\_sen t), 2, “0”), “-”, LPAD(DAY(date\_sent), 2, “0”))) COMMENT ‘(DC2Type:generate d)’; ALTER TABLE mau57\_email\_stats ADD INDEX `mau57_generated_sent_d ate_email_id`(generated\_sent\_date, email\_id)’: \ You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘ALTER TABLE m au57\_email\_stats ADD INDEX `mau57_generated_sent_date_email_id`(…’ at lin e 2 \ In MysqliStatement.php line 86: \ You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘ALTER TABLE m au57\_email\_stats ADD INDEX `mau57_generated_sent_date_email_id`(…’ at lin e 2 \ doctrine:migrations:migrate [–write-sql [WRITE-SQL]] [–dry-run] [–query-time] [–allow-no-migration] [–all-or-nothing [ALL-OR-NOTHING]] [–configuration [CONFIGURATION]] [–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–] [] \    
this’s the log

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [July 19, 2021, 7:54am UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/2 "2021-07-19T07:54:03Z")

</div>

Hi,

1. can you try to send an email with a very small content to test with?
2. do you use Queue for email sending?

Thx  
Joey

---

<div class="post-metadata">

### Author: ![yukzanaly](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/yukzanaly/32/1769_2.png) [@yukzanaly](https://forum.mautic.org/u/yukzanaly)
#### Post date: [August 4, 2021, 3:25am UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/3 "2021-08-04T03:25:27Z")

</div>

Hi,

I tried to send to 5 contacts and it works.  
when I want to send to 6000 contacts it doesn’t work.

the email stats show that all emails have been sent.

but my smtp dashboard doesn’t sent. (only showing 15. the 5 contacts that I tested and some campaign emails)

what’s going on here?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 4, 2021, 11:05am UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/4 "2021-08-04T11:05:43Z")

</div>

> [@joeyk](#):
>
> do you use Queue for email sending?

Sorry, we have to go back to Question Nr.2.:  
2. do you use Queue for email sending?

---

<div class="post-metadata">

### Author: ![yukzanaly](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/yukzanaly/32/1769_2.png) [@yukzanaly](https://forum.mautic.org/u/yukzanaly)
#### Post date: [August 4, 2021, 1:05pm UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/5 "2021-08-04T13:05:07Z")

</div>

No… I send immediately

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 4, 2021, 1:24pm UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/6 "2021-08-04T13:24:05Z")

</div>

Sending over 200 emails without a queue creates big pressure on your server and might time out if your server AND the SMTP is not capable of managing the whole send.

Possible other problem can be that your SMTP provider gets the 5000 emails at once (since there is no queue) and shuts down the comlink - so you are punished for sending too fast.

Did you leave the broadcast open and saw the progress bar slowly moving towards 100%?

I suggest to switch to a queue. (Add the crons needed for that. You can look for my youtube tutorial about how email sending works, gives you some tips.)

---

<div class="post-metadata">

### Author: ![yukzanaly](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/yukzanaly/32/1769_2.png) [@yukzanaly](https://forum.mautic.org/u/yukzanaly)
#### Post date: [August 4, 2021, 2:17pm UTC](https://forum.mautic.org/t/mautic-doesnt-send-emails-to-smtp-api/20204/7 "2021-08-04T14:17:10Z")

</div>

I used to send with queue. I thought if I run mautic on a VPS, I could send email immediately. 😃  
thank you… You rock!
